home *** CD-ROM | disk | FTP | other *** search
/ Aminet 51 / Aminet 51 (2002)(GTI - Schatztruhe)[!][Oct 2002].iso / Aminet / gfx / fract / FlashMandelWOS.lha / FlashMandel / Developer / Modules / React / FM_ARexx_React.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-08-02  |  70.3 KB  |  2,040 lines

  1. /*
  2.  *  FM_ARexx_React.c
  3.  *
  4.  *  functions for reaction-arexx.
  5.  *
  6.  *  $VER: V1.5, 06.06.2002
  7.  *  Coded by Edgar Schwan
  8.  */
  9.  
  10. #include <exec/ports.h>
  11. #include <intuition/classusr.h>
  12. #include <libraries/resource.h>
  13. #include <reaction/reaction.h>
  14. #include <classes/arexx.h>
  15. #include <iffp/ilbmapp.h>
  16. #include <devices/timer.h>
  17. #include <datatypes/datatypesclass.h>
  18. #include <datatypes/soundclass.h>
  19. #include <libraries/asl.h>
  20. #include <dos/dostags.h>
  21.  
  22. #include <clib/exec_protos.h>
  23. #include <clib/dos_protos.h>
  24. #include <clib/intuition_protos.h>
  25. #include <clib/resource_protos.h>
  26. #include <clib/locale_protos.h>
  27. #include <clib/rexxsyslib_protos.h>
  28. #include <clib/iffparse_protos.h>
  29. #include <clib/timer_protos.h>
  30. #include <clib/datatypes_protos.h>
  31. #include <clib/alib_protos.h>
  32.  
  33. #include <pragmas/exec_pragmas.h>
  34. #include <pragmas/dos_pragmas.h>
  35. #include <pragmas/intuition_pragmas.h>
  36. #include <pragmas/resource_pragmas.h>
  37. #include <pragmas/locale_pragmas.h>
  38. #include <pragmas/rexxsyslib_pragmas.h>
  39. #include <pragmas/iffparse_pragmas.h>
  40. #include <pragmas/timer_pragmas.h>
  41. #include <pragmas/datatypes_pragmas.h>
  42.  
  43. #include <stdio.h>
  44. #include <string.h>
  45. #include <stdlib.h>
  46. #include <errno.h>
  47. #include <ctype.h>
  48.  
  49. #include "FM_ARexx_React.h"
  50. #include "FM_ReactionBasics.h"
  51. #include "FM_Reaction.h"
  52. #include "FM_ReactionCD.h"
  53. #include "FM_SysInfoReq_React.h"
  54. #include "FM_ConfirmReq_React.h"
  55. #include "FM_CoordReq_React.h"
  56. #include "FM_InfoReq_React.h"
  57. #include "FM_IntegerReq_React.h"
  58. #include "FM_PalettePref_React.h"
  59. #include "FlashMandel.h"
  60. #include "Compilerspecific.h"
  61.  
  62. #ifdef FM_AREXX_SUPPORT
  63.  
  64. /* external vars */
  65. extern struct Library *ResourceBase;
  66. extern struct Catalog *CatalogPtr;
  67. extern struct Library *DataTypesBase;
  68. extern struct RxsLib *RexxSysBase;
  69.  
  70. extern LDouble RMIN, RMAX, IMIN, IMAX, JKRE, JKIM;
  71. extern TEXT FMSCREENNAME[], MYPATH[];
  72. extern WORD ZOOMLINE[];
  73. extern struct ILBMInfo MYILBM;
  74. extern struct BitMap *MYBITMAP;
  75. extern struct Border MYBORDER;
  76. extern ULONG ELAPSEDTIME, CPUINFO, COLORS, MASK, MAX_ITERATIONS;
  77. extern CHIP UWORD ZoomPointer[];
  78. extern struct Menu *MAINMENU;
  79. extern BOOL res;
  80. extern struct MandelChunk MANDChunk;
  81. extern ULONG *PALETTE;
  82. extern CPTR *VINFO;
  83. extern struct Chunk SPECIAL_CHUNK;
  84. extern struct Chunk USERNAME_CHUNK;
  85. extern struct Chunk COPYRIGHT_CHUNK;
  86. extern LONG PRIORITY, DELAY;
  87. extern WORD MX1, MY1, MX2, MY2, W, H;
  88. extern struct TextAttr MYFONTSTRUCT;
  89. extern TEXT MYFONT[];
  90. extern BOOL ForceAbort;
  91. extern ULONG UPOWER;
  92.  
  93. /* external prototypes */
  94. //BOOL NewCoords(struct Window *, const WORD, const WORD, const WORD, const WORD);
  95. //struct BitMap *CopyBitMap(struct Window *, WORD, WORD, WORD, WORD);
  96. //BOOL PasteBitMap(struct BitMap *, struct Window *, WORD, WORD);
  97. //void SetMenuStart(struct Window *);
  98. //void SetMenuStop(struct Window *);
  99. //void PutPointer(struct Window *, UWORD *, LONG, LONG, LONG, LONG, UBYTE);
  100. //ULONG DrawFractal(struct Window *, const WORD, const WORD, const WORD, const WORD, BOOL);
  101. //void ShowTime(struct Window *, TEXT *, ULONG);
  102. //void SaveCoords(struct Window *, BOOL);
  103. //void SystemInfo(struct Window *Win);
  104. //LONG About(struct Window *);
  105. //LONG Choice(struct Window *, TEXT *, TEXT *);
  106. //LONG WinDump(struct Window *);
  107. //BOOL Fade(struct Window *, ULONG *, ULONG, ULONG, BOOL);
  108. //BOOL Cycle(struct Window *, ULONG, BOOL);
  109. //LONG QueryMandPic(struct ILBMInfo *, struct MandelChunk *, UBYTE *);
  110. //LONG LoadMandPic(struct ILBMInfo *, UBYTE *, BOOL);
  111. //LONG SaveMandPic(struct ILBMInfo *, struct Chunk *, struct Chunk *, UBYTE *);
  112. //LONG LoadPalette(struct ILBMInfo *, UBYTE *, BOOL);
  113. //LONG SavePalette(struct ILBMInfo *, struct Chunk *, UBYTE *);
  114. //void CloseDisplay(struct ILBMInfo *, CPTR *);
  115. //LONG MakeDisplay(struct ILBMInfo *);
  116. //void CheckMenu(struct Window *);
  117. //BOOL FileRequest(struct Window *, TEXT *, TEXT *, BOOL, BOOL);
  118. //ULONG IntegerGad(struct Window *, TEXT *, TEXT *, TEXT *, ULONG);
  119. //BOOL DrawFrame(struct Window *, const WORD, const WORD, const WORD, const WORD);
  120. //BOOL Cycle(struct Window *, ULONG, BOOL);
  121. //BOOL Preview(struct Window *, LONG, LONG);
  122. //void RestoreCoords(struct Window *);
  123. //BOOL ModifyPalette(struct Window *, WORD, WORD, ULONG *);
  124. //BOOL ShowCoords(struct Window *);
  125. //BOOL FontRequest(struct Window *);
  126.  
  127. /* global vars */
  128. Object *ARexxObj = NULL;
  129. ULONG arexxsignal = 0;
  130. struct List ARexxEventList = {0};
  131.  
  132. /* local prototypes */
  133. static BOOL AddARexxEvent(ULONG command, APTR args);
  134. static void RemoveARexxEvent(struct FM_ARexxEvent *event);
  135. static BOOL IsNumber(char *string);
  136.  
  137. /* InitARexx(): Initialize ARexx-Support
  138.  
  139.         SYNOPSIS: BOOL success = InitARexx
  140.                         (
  141.                         RESOURCEFILE        ResPtr;
  142.                         );
  143.  
  144.         INPUTS:        ResPtr:
  145.                             Pointer to the reaction-resource.
  146.  
  147.         RETURNS:        success:
  148.                             Is TRUE, if successfull.
  149. */
  150.  
  151. BOOL InitARexx(RESOURCEFILE ResPtr)
  152. {
  153. ULONG ARexxError = 0;
  154.  
  155. //NewList(&ARexxEventList);
  156. //ARexxEventList.lh_Type = NT_USER;
  157. if (ARexxObj = RL_NewObject(ResPtr, AREXX_128_ID, AREXX_ErrorCode, &ARexxError, TAG_END)) {
  158.     GetAttr(AREXX_SigMask, ARexxObj, (ULONG *) &arexxsignal);
  159.     return(TRUE);
  160.     }
  161. else {
  162.     switch (ARexxError) {
  163.         case RXERR_NO_COMMAND_LIST: {
  164.             fprintf(stderr, "Can't init ARexx-Host - No commands defined.\n");
  165.             break;
  166.             }
  167.         case RXERR_NO_PORT_NAME: {
  168.             fprintf(stderr, "Can't init ARexx-Host - No portname defined.\n");
  169.             break;
  170.             }
  171.         case RXERR_PORT_ALREADY_EXISTS: {
  172.             fprintf(stderr, "Can't init ARexx-Host - portname already exists.\n");
  173.             break;
  174.             }
  175.         case RXERR_OUT_OF_MEMORY: {
  176.             fprintf(stderr, "Can't init ARexx-Host - Out of memory.\n");
  177.             break;
  178.             }
  179.         default: {
  180.             fprintf(stderr, "Can't init ARexx-Host.\n");
  181.             break;
  182.             }
  183.         }
  184.     }
  185.  
  186. FreeARexx(ResPtr);
  187. return(FALSE);
  188. }
  189.  
  190. /* FreeARexx(): Free ARexx-Support.
  191.  
  192.         SYNOPSIS: void = FreeARexx
  193.                         (
  194.                         RESOURCEFILE        ResPtr;
  195.                         );
  196.  
  197.         INPUTS:        ResPtr:
  198.                             Pointer to the reaction-resource.
  199.  
  200.         RETURNS:        -
  201. */
  202. void FreeARexx(RESOURCEFILE ResPtr)
  203. {
  204. if (ARexxObj) {RL_DisposeObject(ResPtr, ARexxObj); ARexxObj = NULL;}
  205. arexxsignal = 0;
  206. }
  207.  
  208. /* AddARexxEvent(): Add an event to the ARexxEvent-List.
  209.  
  210.         SYNOPSIS: BOOL success = AddARexxEvent
  211.                         (
  212.                         ULONG        command;
  213.                         APTR        args;
  214.                         );
  215.  
  216.         INPUTS:        command:
  217.                             ID of the ARexx-command.
  218.  
  219.                         args:
  220.                             Pointer to the command-specific arguments.
  221.  
  222.         RETURNS:        success:
  223.                             Is TRUE. if successfull.
  224. */
  225.  
  226. static BOOL AddARexxEvent(ULONG command, APTR args)
  227. {
  228. BOOL success = FALSE;
  229. struct FM_ARexxEvent *event = NULL;
  230.  
  231. if (event = (struct FM_ARexxEvent *) AllocVec(sizeof(struct FM_ARexxEvent), MEMF_PUBLIC|MEMF_CLEAR)) {
  232.     event->FMRXC_Command = command;
  233.     event->FMRXC_Args = args;
  234.  
  235.     AddTail(&ARexxEventList, (struct Node *) event);
  236.     success = TRUE;
  237.     }
  238. return(success);
  239. }
  240.  
  241. /* RemoveARexxEvent(): Remove an event from the ARexxEvent-List.
  242.  
  243.         SYNOPSIS: void = RemoveARexxEvent
  244.                         (
  245.                         struct FM_ARexxEvent        *event;
  246.                         );
  247.  
  248.         INPUTS:        event:
  249.                             Pointer to the event-structure.
  250.  
  251.         RETURNS:        -
  252. */
  253.  
  254. static void RemoveARexxEvent(struct FM_ARexxEvent *event)
  255. {
  256. Remove((struct Node *) event);
  257. if (event->FMRXC_Args) FreeVec(event->FMRXC_Args);
  258. FreeVec((APTR) event);
  259. }
  260.  
  261. /* IsNumber(): Check, if string is a number (float or int).
  262.  
  263.         SYNOPSIS: BOOL isnum = IsNumber
  264.                         (
  265.                         char        *string;
  266.                         );
  267.  
  268.         INPUTS:        string:
  269.                             Pointer to a string.
  270.  
  271.         RETURNS:        isnum:
  272.                             Is TRUE, if string is a number.
  273. */
  274.  
  275. static BOOL IsNumber(char *string)
  276. {
  277. if (!(*string)) return(FALSE);
  278.  
  279. if ((*string == '+') || (*string == '-')) string++;
  280. while(*string) {
  281.     if (!(isdigit(*string)))
  282.         if (*string != '.') return(FALSE);
  283.     string++;
  284.     }
  285. return(TRUE);
  286. }
  287.  
  288.                                                 /***  ARexx-functions  ***/
  289.  
  290. /* ARexxFunc_Test(): Handle ARexx-Command 'TEST'.   Template: "SWITCH/S,STRING/K,NUMBER/N,NEEDSTR/A,FOLLOW/F" */
  291. void ARexxFunc_Test(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  292. {
  293. struct FM_RxCmd_TEST *args = NULL;
  294. ULONG size1 = 0, size2 = 0, size3 = 0, memsize;
  295.  
  296. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_003; /* no memory available */
  297.  
  298. if (cmd->ac_ArgList[1]) size1 = strlen((const char *) cmd->ac_ArgList[1]) + 1;
  299. if (cmd->ac_ArgList[3]) size2 = strlen((const char *) cmd->ac_ArgList[3]) + 1;
  300. if (cmd->ac_ArgList[4]) size3 = strlen((const char *) cmd->ac_ArgList[4]) + 1;
  301. memsize = sizeof(struct FM_RxCmd_TEST) + size1 + size2 + size3;
  302.  
  303. if (args = (struct FM_RxCmd_TEST *) AllocVec(memsize, MEMF_PUBLIC|MEMF_CLEAR)) {    /* Copy arguments */
  304.     if (cmd->ac_ArgList[0]) args->FMRC_TEST_Switch = (BOOL) (cmd->ac_ArgList[0]);
  305.     if (size1) {
  306.         char *string = (char *) ((ULONG) args + sizeof(struct FM_RxCmd_TEST));
  307.         strcpy(string, (const char *) cmd->ac_ArgList[1]);
  308.         args->FMRC_TEST_String = string;
  309.         }
  310.     if (cmd->ac_ArgList[2]) args->FMRC_TEST_Number = *(LONG *) (cmd->ac_ArgList[2]);
  311.     if (size2) {
  312.         char *string = (char *) ((ULONG) args + sizeof(struct FM_RxCmd_TEST) + size1);
  313.         strcpy(string, (const char *) cmd->ac_ArgList[3]);
  314.         args->FMRC_TEST_NeedStr = string;
  315.         }
  316.     if (size3) {
  317.         char *string = (char *) ((ULONG) args + sizeof(struct FM_RxCmd_TEST) + size1 + size2);
  318.         strcpy(string, (const char *) cmd->ac_ArgList[4]);
  319.         args->FMRC_TEST_Follow = string;
  320.         }
  321.  
  322.     if (AddARexxEvent(0xFFFFFFFF, (APTR) args)) {
  323.         cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  324.         }
  325.     else FreeVec(args);
  326.     }
  327. }
  328.  
  329.                                      /****   PROJECT   ****/
  330.  
  331. /* ARexxFunc_About(): Handle ARexx-Command 'ABOUT'.    Template: - */
  332. void ARexxFunc_About(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  333. {
  334. #if 0        /* external */
  335. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_003; /* no memory available */
  336. if (AddARexxEvent(ABOUT_MSG, NULL)) {
  337.     cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  338.     }
  339. #else        /* internal */
  340. ModifyIDCMP (MYILBM.win, NULL);
  341. ClearMenuStrip (MYILBM.win);
  342. if (ResourceBase) {Do_InfoRequest(MYILBM.win, FMSCREENNAME, 0, 0);}
  343. else {About (MYILBM.win);}
  344. ResetMenuStrip (MYILBM.win, MAINMENU);
  345. ModifyIDCMP (MYILBM.win, IDCMP_STANDARD);
  346. #endif
  347. }
  348.  
  349. /* ARexxFunc_SysInfo(): Handle ARexx-Command 'SYSINFO'.    Template: - */
  350. void ARexxFunc_SysInfo(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  351. {
  352. #if 0        /* external */
  353. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_003; /* no memory available */
  354. if (AddARexxEvent(SYSINFO_MSG, NULL)) {
  355.     cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  356.     }
  357. #else        /* internal */
  358. ModifyIDCMP (MYILBM.win, NULL);
  359. ClearMenuStrip (MYILBM.win);
  360. if (ResourceBase) {Do_SysInfoRequest(MYILBM.win, FMSCREENNAME, 0, 0);}
  361. else {SystemInfo (MYILBM.win);}
  362. ResetMenuStrip (MYILBM.win, MAINMENU);
  363. ModifyIDCMP (MYILBM.win, IDCMP_STANDARD);
  364. #endif
  365. }
  366.  
  367. /* ARexxFunc_Help(): Handle ARexx-Command 'HELP'.   Template: - */
  368. void ARexxFunc_Help(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  369. {
  370. #if 0
  371. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_003; /* no memory available */
  372. if (AddARexxEvent(SHOWGUIDE_MSG, NULL)) {
  373.     cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  374.     }
  375. #else
  376. if (!(system(CATSTR(TXT_CMD_Guide)))) {
  377.     cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_012; /* error return from function */
  378.     }
  379. #endif
  380. }
  381.  
  382. /* ARexxFunc_LoadPicture(): Handle ARexx-Command 'LOAD_PICTURE'.   Template: "PATH,FAST/S" */
  383. void ARexxFunc_LoadPicture(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  384. {
  385. char *path = (char *) cmd->ac_ArgList[0];
  386. BOOL fast = (ULONG) (cmd->ac_ArgList[1]);
  387.  
  388. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_003; /* no memory available */
  389. #if 1        /* external */
  390. {
  391. struct FM_RxCmd_LOADPIC *args = NULL;
  392. ULONG size1 = 0, memsize = 0;
  393.  
  394. if (path) size1 = strlen((const char *) path) + 1;
  395. memsize = sizeof(struct FM_RxCmd_LOADPIC) + size1;
  396.  
  397. if (args = (struct FM_RxCmd_LOADPIC *) AllocVec(memsize, MEMF_PUBLIC|MEMF_CLEAR)) {    /* Copy arguments */
  398.     args->FMRC_LOADPIC_Fast = fast;
  399.     if (size1) {
  400.         char *string = (char *) ((ULONG) args + sizeof(struct FM_RxCmd_LOADPIC));
  401.         strcpy(string, (const char *) cmd->ac_ArgList[0]);
  402.         args->FMRC_LOADPIC_Path = string;
  403.         }
  404.     else     args->FMRC_LOADPIC_Path = NULL;
  405.  
  406.     if (AddARexxEvent(LOADPICTURE_MSG, (APTR) args)) {
  407.         cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  408.         }
  409.     else FreeVec(args);
  410.     }
  411. }
  412. #else        /* internal */
  413. {
  414. LONG Error;
  415.  
  416. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_003; /* no memory available */
  417. if (path) {
  418.     PutPointer(MYILBM.win, 0, 0, 0, 0, 0, BUSY_POINTER);
  419.     if (MYILBM.ParseInfo.iff = AllocIFF()) {
  420.         SaveCoords(MYILBM.win, TRUE);
  421.         if (! (Error = QueryMandPic(&MYILBM, &MANDChunk, path))) {
  422.             RMIN = MANDChunk.RMin;
  423.             RMAX = MANDChunk.RMax;
  424.             IMIN = MANDChunk.IMin;
  425.             IMAX = MANDChunk.IMax;
  426.             JKRE = MANDChunk.JKre;
  427.             JKIM = MANDChunk.JKim;
  428.             MAX_ITERATIONS = MANDChunk.Iterations - 1L;
  429.             if (!(fast)) Fade(MYILBM.win, PALETTE, 25L, 1L, TOBLACK);
  430.             CloseDisplay(&MYILBM, VINFO);
  431.             MYILBM.IFFPFlags = IFFPF_BESTFIT;
  432.             COLORS = MakeDisplay(&MYILBM);
  433.             MYILBM.IFFPFlags = NULL;
  434.             if (! COLORS) {
  435.                 DisplayError(MYILBM.win, TXT_ERR_MakeDisplay, 20L);
  436. //                ARexxFunc_Quit(cmd, rm);
  437.                 return;
  438.                 }
  439.             MASK &= ~ZMASK;
  440.             COLORS -= RESERVED_PENS;
  441.             if (TMASK & MASK) ShowTitle(MYILBM.scr, FALSE);
  442.             if (LoadMandPic (&MYILBM, path, ~fast)) DisplayError(MYILBM.win, TXT_ERR_LoadMandPic, 5L);
  443.             else {cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;}
  444.             if (TMASK & MASK) ShowTitle(MYILBM.scr, TRUE);
  445.             GetRGB32(MYILBM.vp->ColorMap, 0L, (ULONG) MYILBM.vp->ColorMap->Count, PALETTE + 1L);
  446.             CheckMenu(MYILBM.win);
  447.             }
  448.         else {
  449.             DisplayError(MYILBM.win, TXT_ERR_QueryMandPic, 0);
  450.             cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_012; /* error return from function */
  451.             }
  452.         FreeIFF(MYILBM.ParseInfo.iff);
  453.         }
  454.     PutPointer(MYILBM.win, ZoomPointer, ZPW, ZPH, ZPXO, ZPYO, ZOOM_POINTER);
  455.     }
  456. else {
  457.     if (AddARexxEvent(LOADPICTURE_MSG, NULL)) {
  458.         cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  459.         }
  460.     }
  461. }
  462. #endif
  463. }
  464.  
  465. /* ARexxFunc_SavePicture(): Handle ARexx-Command 'SAVE_PICTURE'.   Template: "PATH,FORCE/S" */
  466. void ARexxFunc_SavePicture(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  467. {
  468. char *path = (char *) cmd->ac_ArgList[0];        /* internal only */
  469. BOOL force = (ULONG) (cmd->ac_ArgList[1]);
  470. BPTR lock = NULL;
  471.  
  472. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_003; /* no memory available */
  473. if (!(path)) {
  474.     if (!(FileRequest(MYILBM.win, CATSTR(TXT_SavePictureTitle), "FLASHMANDEL:Pictures", PICTURES_DRAWER, TRUE))) {
  475.         cmd->ac_RC = RC_WARN; cmd->ac_RC2 = 0; return; /* request cancelled */
  476.         }
  477.     }
  478. else strncpy(MYPATH, path, MAX_PATHLEN);
  479.  
  480. if (force == FALSE) {
  481.     if (lock = Lock(MYPATH, ACCESS_READ)) {
  482.         BOOL overwrite = FALSE;
  483.         UnLock(lock);
  484.         if (ResourceBase) overwrite = Do_OverwriteRequest(MYILBM.win, FMSCREENNAME, 0, 0);
  485.         else {
  486.             struct EasyStruct my_req = {sizeof(struct EasyStruct), 0, CATSTR(TITLE_OverwriteReq), CATSTR(OverWr_TXT_Question), CATSTR(TXT_YesNo)};
  487.             overwrite = EasyRequest(MYILBM.win, &my_req, 0);
  488.             }
  489.         if (overwrite == FALSE) {DisplayBeep(NULL); cmd->ac_RC = RC_WARN; cmd->ac_RC2 = 0; return;} /* request cancelled */
  490.         }
  491.     }
  492.  
  493. PutPointer(MYILBM.win, 0, 0, 0, 0, 0, BUSY_POINTER);
  494. if (MYILBM.ParseInfo.iff = AllocIFF()) {
  495.     MANDChunk.LeftEdge = MYILBM.win->LeftEdge;
  496.     MANDChunk.TopEdge = MYILBM.win->TopEdge;
  497.     MANDChunk.Width = MYILBM.win->Width;
  498.     MANDChunk.Height = MYILBM.win->Height;
  499.     MANDChunk.RMin = RMIN;
  500.     MANDChunk.RMax = RMAX;
  501.     MANDChunk.IMin = IMIN;
  502.     MANDChunk.IMax = IMAX;
  503.     MANDChunk.JKre = JKRE;
  504.     MANDChunk.JKim = JKIM;
  505.     MANDChunk.Iterations = MAX_ITERATIONS + 1L;
  506.     if (ZMASK & MASK) {
  507.         DrawBorder(MYILBM.wrp, &MYBORDER, 0, 0);
  508.         MASK &= ~ZMASK;
  509.         }
  510.     if (TMASK & MASK) ShowTitle(MYILBM.scr, FALSE);
  511.     if (SaveMandPic(&MYILBM, &SPECIAL_CHUNK, &USERNAME_CHUNK, MYPATH))
  512.         DisplayError(MYILBM.win, TXT_ERR_SaveMandPic, 5L);
  513.     if (TMASK & MASK) ShowTitle(MYILBM.scr, TRUE);
  514.     FreeIFF (MYILBM.ParseInfo.iff);
  515.     }
  516. PutPointer(MYILBM.win, ZoomPointer, ZPW, ZPH, ZPXO, ZPYO, ZOOM_POINTER);
  517. cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  518. }
  519.  
  520. /* ARexxFunc_LoadPalette(): Handle ARexx-Command 'LOAD_PALETTE'.   Template: "PATH,FAST/S" */
  521. void ARexxFunc_LoadPalette(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  522. {
  523. char *path = (char *) cmd->ac_ArgList[0];        /* internal only */
  524. BOOL fast = (ULONG) (cmd->ac_ArgList[1]);
  525.  
  526. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_003; /* no memory available */
  527. if (!(path)) {
  528.     if (!(FileRequest(MYILBM.win, CATSTR(TXT_LoadPaletteTitle), "FLASHMANDEL:Palettes", PALETTES_DRAWER, FALSE))) {
  529.         cmd->ac_RC = RC_WARN; cmd->ac_RC2 = 0; return;
  530.         }
  531.     }
  532. else strncpy(MYPATH, path, MAX_PATHLEN);
  533.  
  534. PutPointer(MYILBM.win, 0, 0, 0, 0, 0, BUSY_POINTER);
  535. if (MYILBM.ParseInfo.iff = AllocIFF()) {
  536.     if (LoadPalette(&MYILBM, MYPATH, ~fast)) DisplayError(MYILBM.win, TXT_ERR_LoadMandPal, 5L);
  537.     GetRGB32(MYILBM.vp->ColorMap, 0L, (ULONG) MYILBM.vp->ColorMap->Count, PALETTE + 1L);
  538.     FreeIFF(MYILBM.ParseInfo.iff);
  539.     }
  540. else DisplayError(MYILBM.win, TXT_ERR_NoMem, 5L);
  541.  
  542. PutPointer(MYILBM.win, ZoomPointer, ZPW, ZPH, ZPXO, ZPYO, ZOOM_POINTER);
  543. cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  544. }
  545.  
  546. /* ARexxFunc_SavePalette(): Handle ARexx-Command 'SAVE_PALETTE'.   Template: "PATH,FORCE/S" */
  547. void ARexxFunc_SavePalette(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  548. {
  549. char *path = (char *) cmd->ac_ArgList[0];        /* internal only */
  550. BOOL force = (ULONG) (cmd->ac_ArgList[1]);
  551. BPTR lock = NULL;
  552.  
  553. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_003; /* no memory available */
  554. if (!(path)) {
  555.     if (!(FileRequest(MYILBM.win, CATSTR(TXT_SavePaletteTitle), "FLASHMANDEL:Palettes", PALETTES_DRAWER, TRUE))) {
  556.         cmd->ac_RC = RC_WARN; cmd->ac_RC2 = 0; return; /* request cancelled */
  557.         }
  558.     }
  559. else strncpy(MYPATH, path, MAX_PATHLEN);
  560.  
  561. if (force == FALSE) {
  562.     if (lock = Lock(MYPATH, ACCESS_READ)) {
  563.         BOOL overwrite = FALSE;
  564.         UnLock(lock);
  565.         if (ResourceBase) overwrite = Do_OverwriteRequest(MYILBM.win, FMSCREENNAME, 0, 0);
  566.         else {
  567.             struct EasyStruct my_req = {sizeof(struct EasyStruct), 0, CATSTR(TITLE_OverwriteReq), CATSTR(OverWr_TXT_Question), CATSTR(TXT_YesNo)};
  568.             overwrite = EasyRequest(MYILBM.win, &my_req, 0);
  569.             }
  570.         if (overwrite == FALSE) {cmd->ac_RC = RC_WARN; cmd->ac_RC2 = 0; return;} /* request cancelled */
  571.         }
  572.     }
  573.  
  574. PutPointer(MYILBM.win, 0, 0, 0, 0, 0, BUSY_POINTER);
  575. if (MYILBM.ParseInfo.iff = AllocIFF()) {
  576.     if (SavePalette(&MYILBM, ©RIGHT_CHUNK, MYPATH)) DisplayError(MYILBM.win, TXT_ERR_SaveMandPal, 5L);
  577.     FreeIFF(MYILBM.ParseInfo.iff);
  578.     }
  579. else DisplayError(MYILBM.win, TXT_ERR_NoMem, 5L);
  580.  
  581. PutPointer(MYILBM.win, ZoomPointer, ZPW, ZPH, ZPXO, ZPYO, ZOOM_POINTER);
  582. cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  583. }
  584.  
  585. /* ARexxFunc_Print(): Handle ARexx-Command 'PRINT'.   Template: "FORCE/S" */
  586. void ARexxFunc_Print(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  587. {
  588. BOOL force = (ULONG) (cmd->ac_ArgList[0]);
  589. struct FM_RxCmd_PRINT *args = NULL;
  590.  
  591. #if 0        /* external */
  592. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_003; /* no memory available */
  593. if (args = (struct FM_RxCmd_PRINT *) AllocVec(sizeof(struct FM_RxCmd_PRINT), MEMF_PUBLIC|MEMF_CLEAR)) {
  594.     args->FMRC_PRINT_Force = (cmd->ac_ArgList[0]) ? TRUE : FALSE;
  595.     if (AddARexxEvent(DUMP_MSG, (APTR) args)) {
  596.         cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  597.         }
  598.     else FreeVec(args);
  599.     }
  600. #else        /* internal */
  601. ModifyIDCMP (MYILBM.win, NULL);
  602. ClearMenuStrip (MYILBM.win);
  603. PutPointer (MYILBM.win, 0, 0, 0, 0, 0, BUSY_POINTER);
  604. if (!(force)) {
  605.     if (ResourceBase) {res = Do_PrintRequest(MYILBM.win, FMSCREENNAME, 0, 0);}
  606.     else {res = Choice (MYILBM.win,CATSTR(TITLE_PrintReq), CATSTR(Prt_TXT_AreYouSure));}
  607.     }
  608. else res = TRUE;
  609. if (res) WinDump (MYILBM.win);
  610. else {cmd->ac_RC = RC_WARN; cmd->ac_RC2 = 0;} /* user-abort */
  611. PutPointer (MYILBM.win, ZoomPointer, ZPW, ZPH, ZPXO, ZPYO, ZOOM_POINTER);
  612. ResetMenuStrip (MYILBM.win, MAINMENU);
  613. ModifyIDCMP (MYILBM.win, IDCMP_STANDARD);
  614. #endif
  615. }
  616.  
  617. /* ARexxFunc_Quit(): Handle ARexx-Command 'QUIT'.    Template: "FORCE/S,FAST/S" */
  618. void ARexxFunc_Quit(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  619. {
  620. BOOL force = (ULONG) (cmd->ac_ArgList[0]);
  621. BOOL fast = (ULONG) (cmd->ac_ArgList[1]);
  622. struct FM_RxCmd_QUIT *args = NULL;
  623.  
  624. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_003; /* no memory available */
  625. if (args = (struct FM_RxCmd_QUIT *) AllocVec(sizeof(struct FM_RxCmd_QUIT), MEMF_PUBLIC|MEMF_CLEAR)) {
  626.     args->FMRC_QUIT_Force = force ? TRUE : FALSE;
  627.     args->FMRC_QUIT_Fast = fast ? TRUE : FALSE;
  628.     if (AddARexxEvent(EXIT_MSG, (APTR) args)) {
  629.         cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  630.         }
  631.     else FreeVec(args);
  632.     }
  633. }
  634.  
  635.                                      /****   OPTIONS   ****/
  636.  
  637. /* ARexxFunc_ShowTitle(): Handle ARexx-Command 'SHOW_TITLE'.  Template: "BOOLEAN/A/N" */
  638.  
  639. void ARexxFunc_ShowTitle(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  640. {
  641. BOOL show = *(LONG *) (cmd->ac_ArgList[0]);
  642.  
  643. if (!(show)) MASK &= ~TMASK;
  644. else MASK |= TMASK;
  645. MYILBM.TBState = TMASK & MASK;
  646. //ShowTitle(MYILBM.scr, (LONG) MYILBM.TBState);
  647. ShowTitle(MYILBM.scr, (LONG) show);
  648. cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  649. }
  650.  
  651. /* ARexxFunc_ShowElapsed(): Handle ARexx-Command 'SHOW_ELAPSED'.  Template: - */
  652.  
  653. void ARexxFunc_ShowElapsed(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  654. {
  655. if (! (TMASK & MASK)) ShowTitle(MYILBM.scr, TRUE);
  656. ShowTime(MYILBM.win, CATSTR(TXT_LastCalcTime), ELAPSEDTIME);
  657. Delay(TWOSECS);
  658. if (! (TMASK & MASK)) {
  659.     ShowTitle(MYILBM.scr, FALSE);
  660.     }
  661. cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  662. }
  663.  
  664. /* ARexxFunc_SetCoordinates(): Handle ARexx-Command 'SET_COORDINATES'.   Template: "STEM" */
  665. void ARexxFunc_SetCoordinates(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  666. {
  667. char *stem = (char *) cmd->ac_ArgList[0];
  668. char varbuf[100] = {0};
  669. long double tmp_RMIN, tmp_RMAX, tmp_IMIN, tmp_IMAX;
  670. //long long double tmp_JKRE, tmp_JKIM;    for gcc-support
  671. long double tmp_JKRE, tmp_JKIM;
  672. STRPTR value = NULL;
  673.  
  674. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_012; /* error return from function */
  675. if (IsNumber(stem)) {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  676.  
  677. if (stem) {
  678.     sprintf((char *) &varbuf, "%s.RMIN", stem);
  679.     if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  680.         tmp_RMIN = atof((const char *) value);
  681.         if ((errno != ERANGE) && (IsNumber((char *) value))) {
  682.             sprintf((char *) &varbuf, "%s.RMAX", stem);
  683.             if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  684.                 tmp_RMAX = atof((const char *) value);
  685.                 if ((errno != ERANGE) && (IsNumber((char *) value))) {
  686.                     sprintf((char *) &varbuf, "%s.IMIN", stem);
  687.                     if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  688.                         tmp_IMIN = atof((const char *) value);
  689.                         if ((errno != ERANGE) && (IsNumber((char *) value))) {
  690.                             sprintf((char *) &varbuf, "%s.IMAX", stem);
  691.                             if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  692.                                 tmp_IMAX = atof((const char *) value);
  693.                                 if ((errno != ERANGE) && (IsNumber((char *) value))) {
  694.                                     sprintf((char *) &varbuf, "%s.JKRE", stem);
  695.                                     if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  696.                                         tmp_JKRE = atof((const char *) value);
  697.                                         if ((errno != ERANGE) && (IsNumber((char *) value))) {
  698.                                             sprintf((char *) &varbuf, "%s.JKIM", stem);
  699.                                             if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  700.                                                 tmp_JKIM = atof((const char *) value);
  701.                                                 if ((errno != ERANGE) && (IsNumber((char *) value))) {
  702.  
  703.                                                     if ((tmp_RMIN >= tmp_RMAX) || (tmp_IMIN >= tmp_IMAX)) {
  704.                                                         cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; /* invalid argument to function */
  705.                                                         }
  706.                                                     else {
  707.                                                         SaveCoords(MYILBM.win, FALSE);
  708.                                                         RMIN = tmp_RMIN; RMAX = tmp_RMAX; IMIN = tmp_IMIN; IMAX = tmp_IMAX;
  709.                                                         JKRE = tmp_JKRE; JKIM = tmp_JKIM;
  710.                                                         cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  711.                                                         }
  712.                                                     }
  713.                                                 else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018;} /* invalid argument to function */
  714.                                                 }
  715.                                             }
  716.                                         else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018;} /* invalid argument to function */
  717.                                         }
  718.                                     }
  719.                                 else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018;} /* invalid argument to function */
  720.                                 }
  721.                             }
  722.                         else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018;} /* invalid argument to function */
  723.                         }
  724.                     }
  725.                 else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018;} /* invalid argument to function */
  726.                 }
  727.             }
  728.         else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018;} /* invalid argument to function */
  729.         }
  730.     }
  731. else {
  732.     BOOL res1 = FALSE, res2 = FALSE;
  733.     cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  734.  
  735.     ModifyIDCMP(MYILBM.win, NULL);
  736.     ClearMenuStrip(MYILBM.win);
  737.     if (ResourceBase) res1 = Do_CoordinatesRequest(MYILBM.win, FMSCREENNAME, 0, 0);
  738.     else res1 = ShowCoords(MYILBM.win);
  739.     if (res1) {
  740.         if (ResourceBase) res2 = Do_RenderRequest(MYILBM.win, FMSCREENNAME, 0, 0);
  741.         else res2 = Choice (MYILBM.win, CATSTR(TITLE_RenderReq), CATSTR(Rend_TXT_Question));
  742.         }
  743.     else cmd->ac_RC = RC_WARN;
  744.     ResetMenuStrip(MYILBM.win, MAINMENU);
  745.     ModifyIDCMP(MYILBM.win, IDCMP_STANDARD);
  746.  
  747.     if (res2) {
  748.         if (ZMASK & MASK) {
  749.             DrawBorder(MYILBM.wrp, &MYBORDER, 0, 0);
  750.             MASK &= ~ZMASK;
  751.             }
  752.         SetMenuStop(MYILBM.win);
  753.         PutPointer (MYILBM.win, 0, 0, 0, 0, 0, BUSY_POINTER);
  754.         ELAPSEDTIME = DrawFractal(MYILBM.win, MYILBM.win->LeftEdge, MYILBM.win->TopEdge, MYILBM.win->Width, MYILBM.win->Height, TRUE);
  755.         PutPointer(MYILBM.win, ZoomPointer, ZPW, ZPH, ZPXO, ZPYO, ZOOM_POINTER);
  756.         SetMenuStart(MYILBM.win);
  757.         ShowTime(MYILBM.win, CATSTR(TXT_RecalculateTime), ELAPSEDTIME);
  758.         }
  759.     else cmd->ac_RC = RC_WARN;
  760.     }
  761. }
  762.  
  763. /* ARexxFunc_GetCoordinates(): Handle ARexx-Command 'GET_COORDINATES'.   Template: "STEM/A" */
  764. void ARexxFunc_GetCoordinates(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  765. {
  766. char *stem = (char *) cmd->ac_ArgList[0];
  767. char varbuf[100] = {0};
  768. char valbuf[100] = {0};
  769.  
  770. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_012; /* error return from function */
  771. if (IsNumber(stem)) {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  772.  
  773. sprintf((char *) &varbuf, "%s.RMIN", stem); sprintf((char *) &valbuf, "%f", RMIN);
  774. if (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  775.  
  776.     sprintf((char *) &varbuf, "%s.RMAX", stem); sprintf((char *) &valbuf, "%f", RMAX);
  777.     if (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  778.  
  779.         sprintf((char *) &varbuf, "%s.IMIN", stem); sprintf((char *) &valbuf, "%f", IMIN);
  780.         if    (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  781.  
  782.             sprintf((char *) &varbuf, "%s.IMAX", stem); sprintf((char *) &valbuf, "%f", IMAX);
  783.             if (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  784.  
  785.                 sprintf((char *) &varbuf, "%s.JKRE", stem); sprintf((char *) &valbuf, "%f", JKRE);
  786.                 if (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  787.  
  788.                     sprintf((char *) &varbuf, "%s.JKIM", stem); sprintf((char *) &valbuf, "%f", JKIM);
  789.                     if (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  790.  
  791.                         cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  792.                         }
  793.                     }
  794.                 }
  795.             }
  796.         }
  797.     }
  798. }
  799.  
  800. /* ARexxFunc_SetIterations(): Handle ARexx-Command 'SET_ITERATIONS'.  Template: "NUMBER/N" */
  801.  
  802. void ARexxFunc_SetIterations(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  803. {
  804. LONG iterations = *(LONG *) (cmd->ac_ArgList[0]);
  805. UWORD i;
  806. BOOL def = FALSE;
  807. CONST WORD iter_item[9][2] = {{255, 0}, {319, 1}, {511, 2}, {1023, 3}, {2047, 4}, {4095, 5},
  808.                                         {8191, 6}, {16383, 7}, {32767, 8}};
  809.  
  810. if (!(iterations)) {
  811.     ModifyIDCMP(MYILBM.win, NULL);
  812.     ClearMenuStrip(MYILBM.win);
  813.     while (1L) {
  814.         if (ResourceBase) {
  815.             MAX_ITERATIONS = Do_IterationsRequest(MYILBM.win, FMSCREENNAME, 0, 0, MAX_ITERATIONS + 1L) - 1L;
  816.             }
  817.         else {
  818.             MAX_ITERATIONS = (UWORD) IntegerGad(MYILBM.win, CATSTR(TITLE_IterationsReq), CATSTR(TXT_ScrTitle_It), CATSTR(It_TXT_Iterations),MAX_ITERATIONS + 1L) - 1L;
  819.             }
  820.         if ((MAX_ITERATIONS >= MIN_ITERATIONS) && (MAX_ITERATIONS <= MAX_ALLOWED_ITERATIONS)) break;
  821.         DisplayBeep(MYILBM.scr);
  822.         }
  823.     ResetMenuStrip(MYILBM.win, MAINMENU);
  824.     ModifyIDCMP(MYILBM.win, IDCMP_STANDARD);
  825.     }
  826.  
  827. else {
  828.     if ((iterations < (MIN_ITERATIONS + 1)) || (iterations > (MAX_ALLOWED_ITERATIONS + 1))) {
  829.         cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return; /* invalid argument to function */
  830.         }
  831.     MAX_ITERATIONS = iterations - 1L;
  832.     }
  833.  
  834. ItemAddress(MAINMENU, FULLMENUNUM(1, 2, 10))->Flags &= ~CHECKED;
  835. for (i = 0; i < 9; i++) {
  836.     if (MAX_ITERATIONS == iter_item[i][0]) {
  837.         ItemAddress(MAINMENU, FULLMENUNUM(1, 2, iter_item[i][1]))->Flags |= CHECKED;
  838.         def = TRUE;
  839.         }
  840.     else ItemAddress(MAINMENU, FULLMENUNUM(1, 2, iter_item[i][1]))->Flags &= ~CHECKED;
  841.     }
  842. if (def == FALSE) ItemAddress(MAINMENU, FULLMENUNUM(1, 2, 10))->Flags |= CHECKED;
  843.  
  844. cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  845. }
  846.  
  847. /* ARexxFunc_GetIterations(): Handle ARexx-Command 'GET_ITERATIONS'.  Template: "VAR/A" */
  848.  
  849. void ARexxFunc_GetIterations(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  850. {
  851. char *var = (char *) cmd->ac_ArgList[0];
  852. char valbuf[100] = {0};
  853.  
  854. cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; /* invalid argument to function */
  855. if (IsNumber(var)) return;
  856.  
  857. sprintf((char *) &valbuf, "%d", MAX_ITERATIONS + 1);
  858. if (!(SetRexxVar(rm, (STRPTR) var, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  859.     cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  860.     }
  861. }
  862.  
  863. /* ARexxFunc_SetPower(): Handle ARexx-Command 'SET_POWER'.  Template: "INDEX/A/N" */
  864.  
  865. void ARexxFunc_SetPower(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  866. {
  867. LONG Index = *(LONG *) (cmd->ac_ArgList[0]);
  868. int s;
  869.  
  870. cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; /* invalid argument to function */
  871.  
  872. if ((Index >= 1) && (Index <= 11)) {
  873.     for (s = Index - 1; s < 11; s++) {
  874.         ItemAddress(MAINMENU, FULLMENUNUM(1, 3, s))->Flags &= ~CHECKED;
  875.         }
  876.  
  877.     MANDChunk.Power = Index - 1;
  878.     ItemAddress(MAINMENU, FULLMENUNUM(1, 3, Index - 1))->Flags |= CHECKED;
  879.  
  880.     cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  881.     }
  882. }
  883.  
  884. /* ARexxFunc_GetPower(): Handle ARexx-Command 'GET_POWER'.  Template: "VAR/A" */
  885.  
  886. void ARexxFunc_GetPower(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  887. {
  888. char *var = (char *) cmd->ac_ArgList[0];
  889. char valbuf[100] = {0};
  890.  
  891. cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; /* invalid argument to function */
  892. if (IsNumber(var)) return;
  893.  
  894. sprintf((char *) &valbuf, "%d", MANDChunk.Power + 1);
  895. if (!(SetRexxVar(rm, (STRPTR) var, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  896.     cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  897.     }
  898. }
  899.  
  900. /* ARexxFunc_SetPriority(): Handle ARexx-Command 'SET_PRIORITY'.  Template: "PRI/A" */
  901.  
  902. void ARexxFunc_SetPriority(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  903. {
  904. char *pristr = (char *) cmd->ac_ArgList[0];
  905. LONG pri, p;
  906. CONST WORD pri_item[11][2] = {{-5, 0}, {-4, 1}, {-3, 2}, {-2, 3}, {-1, 4}, {0, 6}, {1, 8}, {2, 9},
  907.                                         {3, 10}, {4, 11}, {5, 12}};
  908.  
  909. cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; /* invalid argument to function */
  910.  
  911. if (!(IsNumber(pristr))) return;
  912.  
  913. pri = atol(pristr); if (errno != ERANGE) {
  914.     if ((pri <= 5L) && (pri >= -5L)) {
  915.         PRIORITY = pri;
  916.  
  917.         for (p = 0; p < 11; p++) {
  918.             if (pri == pri_item[p][0]) ItemAddress(MAINMENU, FULLMENUNUM(1, 4, pri_item[p][1]))->Flags |= CHECKED;
  919.             else ItemAddress(MAINMENU, FULLMENUNUM(1, 4, pri_item[p][1]))->Flags &= ~CHECKED;
  920.             }
  921.         cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  922.         }
  923.     }
  924. }
  925.  
  926. /* ARexxFunc_GetPriority(): Handle ARexx-Command 'GET_PRIORITY'.  Template: "VAR/A" */
  927.  
  928. void ARexxFunc_GetPriority(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  929. {
  930. char *var = (char *) cmd->ac_ArgList[0];
  931. char valbuf[100] = {0};
  932.  
  933. cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; /* invalid argument to function */
  934. if (IsNumber(var)) return;
  935.  
  936. sprintf((char *) &valbuf, "%d", PRIORITY);
  937. if (!(SetRexxVar(rm, (STRPTR) var, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  938.     cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  939.     }
  940. }
  941.  
  942. /* ARexxFunc_SetColorRemap(): Handle ARexx-Command 'SET_COLOR_REMAP'.  Template: "INDEX/A/N" */
  943.  
  944. void ARexxFunc_SetColorRemap(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  945. {
  946. LONG Index = *(LONG *) (cmd->ac_ArgList[0]);
  947. int s;
  948. CONST ULONG bit_item[MAX_COLOR_REMAP][2] = {{LINEAR_BIT, 0}, {LOG_BIT, 1}, {REPEATED_BIT, 2}, {SQUARE_BIT, 3},
  949.                                                          {ONE_BIT, 4}, {TWO_BIT, 5}, {THREE_BIT, 6}, {FOUR_BIT, 7}};
  950.  
  951. cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; /* invalid argument to function */
  952.  
  953. if ((Index >= MIN_COLOR_REMAP) && (Index <= MAX_COLOR_REMAP)) {
  954.     for (s = MIN_COLOR_REMAP - 1; s < MAX_COLOR_REMAP; s++) {
  955.         ItemAddress(MAINMENU, FULLMENUNUM(1, 5, s))->Flags &= ~CHECKED;
  956.         MANDChunk.Flags &= ~bit_item[s][0];
  957.         }
  958.  
  959.     MANDChunk.Flags |= bit_item[Index - 1][0];
  960.     ItemAddress(MAINMENU, FULLMENUNUM(1, 5, bit_item[Index - 1][1]))->Flags |= CHECKED;
  961.  
  962.     cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  963.     }
  964. }
  965.  
  966. /* ARexxFunc_GetColorRemap(): Handle ARexx-Command 'GET_COLOR_REMAP'.  Template: "VAR/A" */
  967.  
  968. void ARexxFunc_GetColorRemap(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  969. {
  970. char *var = (char *) cmd->ac_ArgList[0];
  971. char valbuf[100] = {0};
  972. int s;
  973. LONG Index = 0;
  974. CONST ULONG bit_idx[MAX_COLOR_REMAP][2] = {{LINEAR_BIT, 1}, {LOG_BIT, 2}, {REPEATED_BIT, 3}, {SQUARE_BIT, 4},
  975.                                                         {ONE_BIT, 5}, {TWO_BIT, 6}, {THREE_BIT, 7}, {FOUR_BIT, 8}};
  976.  
  977. cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; /* invalid argument to function */
  978. if (IsNumber(var)) return;
  979.  
  980. for (s = MIN_COLOR_REMAP - 1; s < MAX_COLOR_REMAP; s++) {    
  981.     if (MANDChunk.Flags & bit_idx[s][0]) {Index = bit_idx[s][1]; break;}
  982.     }
  983.  
  984. if (!(Index)) {cmd->ac_RC2 = 0; return;}
  985.  
  986. sprintf((char *) &valbuf, "%d", Index);
  987. if (!(SetRexxVar(rm, (STRPTR) var, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  988.     cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  989.     }
  990. }
  991.  
  992. /* ARexxFunc_SetFractalType(): Handle ARexx-Command 'SET_FRACTAL_TYPE'.  Template: "INDEX/A/N" */
  993.  
  994. void ARexxFunc_SetFractalType(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  995. {
  996. LONG Index = *(LONG *) (cmd->ac_ArgList[0]);
  997.  
  998. switch (Index) {
  999.     case 1:
  1000.         MANDChunk.Flags &= ~MANDEL_BIT;
  1001.         MANDChunk.Flags |= JULIA_BIT;
  1002.         ItemAddress(MAINMENU, FULLMENUNUM(1, 6, 0))->Flags |= CHECKED;
  1003.         ItemAddress(MAINMENU, FULLMENUNUM(1, 6, 1))->Flags &= ~CHECKED;
  1004.         break;
  1005.     case 2:
  1006.         MANDChunk.Flags &= ~JULIA_BIT;
  1007.         MANDChunk.Flags |= MANDEL_BIT;
  1008.         ItemAddress(MAINMENU, FULLMENUNUM(1, 6, 0))->Flags &= ~CHECKED;
  1009.         ItemAddress(MAINMENU, FULLMENUNUM(1, 6, 1))->Flags |= CHECKED;
  1010.         break;
  1011.     default:
  1012.         cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; /* invalid argument to function */
  1013.         return;
  1014.     }
  1015.  
  1016. cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1017. }
  1018.  
  1019. /* ARexxFunc_GetFractalType(): Handle ARexx-Command 'GET_FRACTAL_TYPE'.  Template: "VAR/A" */
  1020.  
  1021. void ARexxFunc_GetFractalType(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1022. {
  1023. char *var = (char *) cmd->ac_ArgList[0];
  1024. char valbuf[100] = {0};
  1025. int Index = 0;
  1026.  
  1027. cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; /* invalid argument to function */
  1028. if (IsNumber(var)) return;
  1029.  
  1030. if (MANDChunk.Flags & MANDEL_BIT) Index = 2;
  1031.     else if (MANDChunk.Flags & JULIA_BIT) Index = 1;
  1032.         else return;
  1033.  
  1034. sprintf((char *) &valbuf, "%d", Index);
  1035. if (!(SetRexxVar(rm, (STRPTR) var, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  1036.     cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1037.     }
  1038. }
  1039.  
  1040. /* ARexxFunc_SetCPUType(): Handle ARexx-Command 'SET_CPU_TYPE'.  Template: "INDEX/A/N" */
  1041.  
  1042. void ARexxFunc_SetCPUType(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1043. {
  1044. LONG Index = *(LONG *) (cmd->ac_ArgList[0]);
  1045.  
  1046. switch (Index) {
  1047.     case 2:
  1048.         MANDChunk.Flags &= ~MC68K_BIT;
  1049.         MANDChunk.Flags |= PPC_BIT;
  1050.         if (CPUINFO & (CPU_603|CPU_603e|CPU_604|CPU_604e|CPU_620)) {
  1051.             ItemAddress(MAINMENU, FULLMENUNUM(1, 7, 0))->Flags &= ~CHECKED;
  1052.             ItemAddress(MAINMENU, FULLMENUNUM(1, 7, 1))->Flags |= CHECKED;
  1053.             break;
  1054.             }
  1055.     case 1:
  1056.         MANDChunk.Flags &= ~PPC_BIT;
  1057.         MANDChunk.Flags |= MC68K_BIT;
  1058.         ItemAddress(MAINMENU, FULLMENUNUM(1, 7, 0))->Flags |= CHECKED;
  1059.         ItemAddress(MAINMENU, FULLMENUNUM(1, 7, 1))->Flags &= ~CHECKED;
  1060.         break;
  1061.     default:
  1062.         cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; /* invalid argument to function */
  1063.     }
  1064.  
  1065. cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1066. }
  1067.  
  1068. /* ARexxFunc_GetCPUType(): Handle ARexx-Command 'GET_CPU_TYPE'.  Template: "VAR/A" */
  1069.  
  1070. void ARexxFunc_GetCPUType(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1071. {
  1072. char *var = (char *) cmd->ac_ArgList[0];
  1073. char valbuf[100] = {0};
  1074. int Index = 0;
  1075.  
  1076. cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; /* invalid argument to function */
  1077. if (IsNumber(var)) return;
  1078.  
  1079. if (MANDChunk.Flags & MC68K_BIT) Index = 1;
  1080.     else if (MANDChunk.Flags & PPC_BIT) Index = 2;
  1081.         else return;
  1082.  
  1083. sprintf((char *) &valbuf, "%d", Index);
  1084. if (!(SetRexxVar(rm, (STRPTR) var, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  1085.     cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1086.     }
  1087. }
  1088.  
  1089.                                      /****      ****/
  1090.  
  1091. /* ARexxFunc_ShowPreview(): Handle ARexx-Command 'SHOW_PREVIEW'.  Template: - */
  1092.  
  1093. void ARexxFunc_ShowPreview(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1094. {
  1095. if (NewCoords (MYILBM.win, ZOOMLINE[6], ZOOMLINE[3], ZOOMLINE[4], ZOOMLINE[5])) {
  1096.     ModifyIDCMP(MYILBM.win, NULL);
  1097.     ClearMenuStrip(MYILBM.win);
  1098.     Preview(MYILBM.win, MYILBM.win->Width, MYILBM.win->Height);
  1099.     ResetMenuStrip(MYILBM.win, MAINMENU);
  1100.     ModifyIDCMP(MYILBM.win, IDCMP_STANDARD);
  1101.     RestoreCoords(MYILBM.win);
  1102.     }
  1103. }
  1104.  
  1105. /* ARexxFunc_Render(): Handle ARexx-Command 'RENDER'.   Template: "FORCE/S" */
  1106. void ARexxFunc_Render(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1107. {
  1108. BOOL force = (ULONG) (cmd->ac_ArgList[0]);
  1109. struct FM_RxCmd_RENDER *args = NULL;
  1110.  
  1111. if (force == FALSE) {
  1112.     if (ResourceBase) res = Do_RenderRequest(MYILBM.win, FMSCREENNAME,0,0);
  1113.     else res = Choice(MYILBM.win, CATSTR(TITLE_RenderReq), CATSTR(NewScr_TXT_Question));
  1114.     if (res == FALSE) {cmd->ac_RC = RC_WARN; cmd->ac_RC2 = 0; return;}
  1115.     }
  1116.  
  1117. #if 0        /* external */
  1118. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_012; /* error return from function */
  1119. if (args = (struct FM_RxCmd_RENDER *) AllocVec(sizeof(struct FM_RxCmd_RENDER), MEMF_PUBLIC|MEMF_CLEAR)) {
  1120.     args->FMRC_RENDER_Force = (cmd->ac_ArgList[0]) ? TRUE : FALSE;
  1121.     if (AddARexxEvent(REDRAW_MSG, (APTR) args)) {
  1122.         cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1123.         }
  1124.     else FreeVec(args);
  1125.     }
  1126. #else        /* internal */
  1127. if (ZMASK & MASK) {
  1128.     DrawBorder(MYILBM.wrp, &MYBORDER, 0, 0);
  1129.     MASK &= ~ZMASK;
  1130.     }
  1131. SetMenuStop(MYILBM.win);
  1132. PutPointer (MYILBM.win, 0, 0, 0, 0, 0, BUSY_POINTER);
  1133. ELAPSEDTIME = DrawFractal(MYILBM.win, MYILBM.win->LeftEdge, MYILBM.win->TopEdge, MYILBM.win->Width, MYILBM.win->Height, TRUE);
  1134. PutPointer(MYILBM.win, ZoomPointer, ZPW, ZPH, ZPXO, ZPYO, ZOOM_POINTER);
  1135. SetMenuStart(MYILBM.win);
  1136. ShowTime(MYILBM.win, CATSTR(TXT_RecalculateTime), ELAPSEDTIME);
  1137.  
  1138. if (rm->rm_Action & RXFF_RESULT) {
  1139.     char string[50];
  1140.     STRPTR ResultString;
  1141.  
  1142.     sprintf((STRPTR) &string, "%ld", ELAPSEDTIME);
  1143.     if (ResultString = CreateArgstring((STRPTR) &string, strlen((const char *) &string))) {
  1144.         cmd->ac_Result = ResultString;
  1145.         }
  1146.     }
  1147. #endif
  1148. }
  1149.  
  1150. /* ARexxFunc_Undo(): Handle ARexx-Command 'UNDO'.  Template: - */
  1151.  
  1152. void ARexxFunc_Undo(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1153. {
  1154. RestoreCoords(MYILBM.win);
  1155. }
  1156.  
  1157. /* ARexxFunc_SetFrame(): Handle ARexx-Command 'SET_FRAME'.   Template: "STEM/A" */
  1158. void ARexxFunc_SetFrame(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1159. {
  1160. char *stem = (char *) cmd->ac_ArgList[0];
  1161. char varbuf[100] = {0};
  1162. WORD tmp_left, tmp_top, tmp_right, tmp_bottom;
  1163. STRPTR value = NULL;
  1164. struct Screen *scr = NULL;
  1165.  
  1166. cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; /* invalid argument to function */
  1167. if (IsNumber(stem)) return;
  1168.  
  1169. if (scr = LockPubScreen(FMSCREENNAME)) {
  1170.     if (stem) {
  1171.         sprintf((char *) &varbuf, "%s.LEFT", stem);                    /* frame-left */
  1172.         if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  1173.             tmp_left = atol((const char *) value);
  1174.             if ((errno == ERANGE) || (!(IsNumber((char *) value))) || (tmp_left < 0)) goto Error;
  1175.  
  1176.             sprintf((char *) &varbuf, "%s.TOP", stem);                    /* frame-top */
  1177.             if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  1178.                 tmp_top = atol((const char *) value);
  1179.                 if ((errno == ERANGE) || (!(IsNumber((char *) value))) || (tmp_top < 0)) goto Error;
  1180.  
  1181.                 sprintf((char *) &varbuf, "%s.RIGHT", stem);                    /* frame-right */
  1182.                 if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  1183.                     tmp_right = atol((const char *) value);
  1184.                     if ((errno == ERANGE) || (!(IsNumber((char *) value))) || (tmp_right < 0)) goto Error;
  1185.  
  1186.                     sprintf((char *) &varbuf, "%s.BOTTOM", stem);                /* frame-bottom */
  1187.                     if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  1188.                         tmp_bottom = atol((const char *) value);
  1189.                         if ((errno == ERANGE) || (!(IsNumber((char *) value))) || (tmp_bottom < 0)) goto Error;
  1190.  
  1191.                         if (tmp_right > (scr->Width - 1)) tmp_right = scr->Width -1;
  1192.                         if (tmp_bottom > (scr->Height - 1)) tmp_bottom = scr->Height -1;
  1193.  
  1194.                         if ((tmp_right > tmp_left) && (tmp_bottom > tmp_top) && (tmp_right < scr->Width) && (tmp_bottom < scr->Height)) {
  1195.                             WORD width = tmp_right - tmp_left + 1;
  1196.                             WORD height = tmp_bottom - tmp_top + 1;
  1197.  
  1198.                             if (ZMASK & MASK) {
  1199.                                 DrawBorder(MYILBM.wrp, &MYBORDER, 0, 0);
  1200.                                 MASK &= ~ZMASK;
  1201.                                 }
  1202.  
  1203.                             if (width > height) (width = ScalerDiv((LONG) height,(ULONG) MYILBM.win->Width,(ULONG) MYILBM.win->Height));
  1204.                             else (height = ScalerDiv((LONG) width,(ULONG) MYILBM.win->Height,(ULONG) MYILBM.win->Width));
  1205.  
  1206.                             ZOOMLINE [8] = ZOOMLINE [0] = ZOOMLINE [6] = tmp_left;
  1207.                             ZOOMLINE [1] = ZOOMLINE [3] = ZOOMLINE [9] = tmp_top;
  1208.                             ZOOMLINE [2] = ZOOMLINE [4] = tmp_left + width - 1;
  1209.                             ZOOMLINE [5] = ZOOMLINE [7] = tmp_top + height - 1;
  1210.                             MX1 = tmp_left; MY1 = tmp_top;
  1211.                             W = width, H = height;
  1212.  
  1213.                             DrawBorder(MYILBM.wrp, &MYBORDER, 0, 0);
  1214.                             MASK |= ZMASK;
  1215.  
  1216.                             cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1217.                             }
  1218.                         else MASK &= ~ZMASK;
  1219.  
  1220.                         if (ZMASK & MASK) {
  1221.                             OnMenu(MYILBM.win, FULLMENUNUM(2, 0, NOSUB));
  1222.                             OnMenu(MYILBM.win, FULLMENUNUM(2, 6, NOSUB));
  1223.                             }
  1224.                         else {
  1225.                             OffMenu(MYILBM.win, FULLMENUNUM(2, 0, NOSUB));
  1226.                             OffMenu(MYILBM.win, FULLMENUNUM(2, 6, NOSUB));
  1227.                             }
  1228.                         }
  1229.                     }
  1230.                 }
  1231.             }
  1232.         }
  1233. Error:
  1234.     UnlockPubScreen(FMSCREENNAME, scr); return;
  1235.     }
  1236. }
  1237.  
  1238. /* ARexxFunc_GetFrame(): Handle ARexx-Command 'GET_FRAME'.   Template: "STEM/A" */
  1239. void ARexxFunc_GetFrame(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1240. {
  1241. char *stem = (char *) cmd->ac_ArgList[0];
  1242. char varbuf[100] = {0};
  1243. char valbuf[100] = {0};
  1244.  
  1245. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_012; /* error return from function */
  1246.  
  1247. sprintf((char *) &varbuf, "%s.LEFT", stem); sprintf((char *) &valbuf, "%d", ZOOMLINE[6]);
  1248. if    (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  1249.  
  1250.     sprintf((char *) &varbuf, "%s.TOP", stem); sprintf((char *) &valbuf, "%d", ZOOMLINE[3]);
  1251.     if    (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  1252.  
  1253.         sprintf((char *) &varbuf, "%s.RIGHT", stem); sprintf((char *) &valbuf, "%d", ZOOMLINE[4]);
  1254.         if (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  1255.  
  1256.             sprintf((char *) &varbuf, "%s.BOTTOM", stem); sprintf((char *) &valbuf, "%d", ZOOMLINE[5]);
  1257.             if (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  1258.  
  1259.                 cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1260.                 }
  1261.             }
  1262.         }
  1263.     }
  1264. }
  1265.  
  1266. /* ARexxFunc_Zoom(): Handle ARexx-Command 'ZOOM'.   Template: "LEFT/A/N,TOP/A/N,WIDTH/A/N,HEIGHT/A/N,REPEATS/N,FAST/S,STEPS/N" */
  1267. void ARexxFunc_Zoom(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1268. {
  1269. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_003; /* no memory available    */
  1270.  
  1271. #if 0        /* external */
  1272. {
  1273. struct FM_RxCmd_ZOOM *args = NULL;
  1274.  
  1275. if (args = (struct FM_RxCmd_ZOOM *) AllocVec(sizeof(struct FM_RxCmd_ZOOM), MEMF_PUBLIC|MEMF_CLEAR)) {    /* Copy arguments */
  1276.     args->FMRC_ZOOM_Left = *(LONG *) (cmd->ac_ArgList[0]);
  1277.     args->FMRC_ZOOM_Top = *(LONG *) (cmd->ac_ArgList[1]);
  1278.     args->FMRC_ZOOM_Width = *(LONG *) (cmd->ac_ArgList[2]);
  1279.     args->FMRC_ZOOM_Height = *(LONG *) (cmd->ac_ArgList[3]);
  1280.     args->FMRC_ZOOM_Repeats = cmd->ac_ArgList[4] ? *(LONG *) (cmd->ac_ArgList[4]) : 1;
  1281.     args->FMRC_ZOOM_Fast = cmd->ac_ArgList[5] ? (ULONG) (cmd->ac_ArgList[5]) : FALSE;
  1282.     args->FMRC_ZOOM_Steps = cmd->ac_ArgList[6] ? *(LONG *) (cmd->ac_ArgList[6]) : 1;  /* not supported yet */
  1283.     if (AddARexxEvent(DRAW_MSG, (APTR) args)) {
  1284.         cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1285.         return;
  1286.         }
  1287.     else FreeVec(args);
  1288.     }
  1289. }
  1290. #else        /* internal */
  1291. {
  1292. LONG left = *(LONG *) (cmd->ac_ArgList[0]), top = *(LONG *) (cmd->ac_ArgList[1]);
  1293. LONG right = left + (*(LONG *) (cmd->ac_ArgList[2])) - 1;
  1294. LONG bottom = top + (*(LONG *) (cmd->ac_ArgList[3])) - 1;
  1295. LONG repeats = 1, steps = 1, elapsed = 0;
  1296. BOOL fast = (ULONG) (cmd->ac_ArgList[5]);
  1297. int i;
  1298. struct Screen *scr = NULL;
  1299. WORD scrwidth = 0, scrheight = 0;
  1300.  
  1301. if (cmd->ac_ArgList[4]) repeats = *(LONG *) (cmd->ac_ArgList[4]);
  1302. if (cmd->ac_ArgList[6]) steps = *(LONG *) (cmd->ac_ArgList[6]);  /* not supported yet */
  1303.  
  1304. if (scr = LockPubScreen(FMSCREENNAME)) {
  1305.     scrwidth = scr->Width; scrheight = scr->Height;
  1306.     UnlockPubScreen(FMSCREENNAME, scr);
  1307.     }
  1308. else {cmd->ac_RC2 = ERR10_012; return;}  /* error return from function */
  1309.  
  1310.  /* Check parameters */
  1311. if ((left < 0) || (top < 0) || (right > (scrwidth - 1)) || (bottom > (scrheight - 1)) || (repeats < 0)) {
  1312.     cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return; /* invalid argument to function */
  1313.     }
  1314.  
  1315. if (fast == FALSE) {
  1316.     for (i = 0; i < repeats; i++) {
  1317.         ZOOMLINE[6] = left; ZOOMLINE[3] = top; ZOOMLINE[4] = right; ZOOMLINE[5] = bottom;
  1318.         if (ZMASK & MASK) {
  1319.             DrawBorder(MYILBM.wrp, &MYBORDER, 0, 0);
  1320.             MASK &= ~ZMASK;
  1321.             }
  1322.         if (NewCoords(MYILBM.win, ZOOMLINE[6], ZOOMLINE[3], ZOOMLINE[4], ZOOMLINE[5])) {
  1323.             MYBITMAP = CopyBitMap(MYILBM.win, ZOOMLINE[6], ZOOMLINE[3], ZOOMLINE[4]-ZOOMLINE[6]+1, ZOOMLINE[5]-ZOOMLINE[3]+1);
  1324.             PasteBitMap(MYBITMAP, MYILBM.win, ZOOMLINE[4]-ZOOMLINE[6]+1, ZOOMLINE[5]-ZOOMLINE[3]+1);
  1325.             SetMenuStop(MYILBM.win);
  1326.             PutPointer(MYILBM.win, 0, 0, 0, 0, 0, BUSY_POINTER);
  1327.             elapsed += DrawFractal(MYILBM.win, MYILBM.win->LeftEdge, MYILBM.win->TopEdge, MYILBM.win->Width, MYILBM.win->Height, FALSE);
  1328.             PutPointer(MYILBM.win, ZoomPointer, ZPW, ZPH, ZPXO, ZPYO, ZOOM_POINTER);
  1329.             SetMenuStart(MYILBM.win);
  1330.             }
  1331.         }
  1332.     }
  1333. else {
  1334.     SetMenuStop(MYILBM.win);
  1335.     for (i = 0; i < repeats; i++) {
  1336.         ZOOMLINE[6] = left; ZOOMLINE[3] = top; ZOOMLINE[4] = right; ZOOMLINE[5] = bottom;
  1337.         if (NewCoords(MYILBM.win, ZOOMLINE[6], ZOOMLINE[3], ZOOMLINE[4], ZOOMLINE[5])) {
  1338.             elapsed += DrawFractal(MYILBM.win, MYILBM.win->LeftEdge, MYILBM.win->TopEdge, MYILBM.win->Width, MYILBM.win->Height, FALSE);
  1339.             }
  1340.         }
  1341.     SetMenuStart(MYILBM.win);
  1342.     }
  1343.  
  1344. ELAPSEDTIME = elapsed;
  1345. ShowTime(MYILBM.win, CATSTR(TXT_ZoomTime), ELAPSEDTIME);
  1346. cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1347. if (rm->rm_Action & RXFF_RESULT) {
  1348.     char string[50];
  1349.     STRPTR ResultString;
  1350.  
  1351.     sprintf((STRPTR) &string, "%ld", elapsed);
  1352.     if (ResultString = CreateArgstring((STRPTR) &string, strlen((const char *) &string))) {
  1353.         cmd->ac_Result = ResultString;
  1354.         }
  1355.     }
  1356. }
  1357. #endif
  1358. }
  1359.  
  1360.                                      /****   DISPLAY   ****/
  1361.  
  1362. /* ARexxFunc_DoColorcycling(): Handle ARexx-Command 'DO_COLORCYCLING'.  Template: "FORWARD/S,BACKWARD/S" */
  1363.  
  1364. void ARexxFunc_DoColorcycling(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1365. {
  1366. BOOL forward = (ULONG) (cmd->ac_ArgList[0]);
  1367. BOOL backward = (ULONG) (cmd->ac_ArgList[1]);
  1368. BOOL flag = SHIFTLEFT;
  1369.  
  1370. cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; /* invalid argument to function */
  1371.  
  1372. if ((forward && backward) || (!forward && !backward)) return;
  1373. if (forward) flag = SHIFTRIGHT;
  1374.  
  1375. ModifyIDCMP(MYILBM.win, IDCMP_MOUSEBUTTONS|IDCMP_RAWKEY|IDCMP_MENUPICK);
  1376. if (TMASK & MASK) ShowTitle(MYILBM.scr, FALSE);
  1377. ClearMenuStrip (MYILBM.win);
  1378. PutPointer(MYILBM.win, 0, 0, 0, 0, 0, BUSY_POINTER);
  1379. Cycle(MYILBM.win, DELAY, flag);
  1380. PutPointer(MYILBM.win, ZoomPointer, ZPW, ZPH, ZPXO, ZPYO, ZOOM_POINTER);
  1381. ResetMenuStrip(MYILBM.win, MAINMENU);
  1382. if (TMASK & MASK) ShowTitle(MYILBM.scr, TRUE);
  1383. LoadRGB32(MYILBM.vp, PALETTE);
  1384. ModifyIDCMP(MYILBM.win, IDCMP_STANDARD);
  1385. cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1386. }
  1387.  
  1388. /* ARexxFunc_SetDelay(): Handle ARexx-Command 'SET_DELAY'.  Template: "SECONDS/N" */
  1389.  
  1390. void ARexxFunc_SetDelay(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1391. {
  1392. LONG tmp_DELAY = *(LONG *) cmd->ac_ArgList[0];
  1393.  
  1394. cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1395.  
  1396. if (!(tmp_DELAY)) {
  1397.     while (1L) {
  1398.         if (ResourceBase) tmp_DELAY = Do_CycleDelayRequest(MYILBM.win, FMSCREENNAME, 0, 0, DELAY);
  1399.         else tmp_DELAY = IntegerGad(MYILBM.win, CATSTR(TITLE_CycleDelayReq), CATSTR(TXT_ScrTitle_Cyc), CATSTR(Cyc_TXT_DelayTime), DELAY);
  1400.         if ((tmp_DELAY >= 0L) && (tmp_DELAY <= 200)) {DELAY = tmp_DELAY; return;}
  1401.         }
  1402.     }
  1403.  
  1404. else {
  1405.     if ((tmp_DELAY >= 0L) && (tmp_DELAY <= 200)) {DELAY = tmp_DELAY; return;}
  1406.     }
  1407.  
  1408. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_012; /* error return from function */
  1409. DisplayBeep (MYILBM.scr);
  1410. }
  1411.  
  1412. /* ARexxFunc_GetDelay(): Handle ARexx-Command 'GET_DELAY'.  Template: "VAR/A" */
  1413.  
  1414. void ARexxFunc_GetDelay(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1415. {
  1416. char *var = (char *) cmd->ac_ArgList[0];
  1417. char valbuf[100] = {0};
  1418.  
  1419. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_012; /* error return from function */
  1420.  
  1421. sprintf((char *) &valbuf, "%d", DELAY);
  1422. if (!(SetRexxVar(rm, (STRPTR) var, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  1423.     cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1424.     }
  1425. }
  1426.  
  1427. /* ARexxFunc_SetPalette(): Handle ARexx-Command 'SET_PALETTE'.  Template: "STEM,FAST/S" */
  1428.  
  1429. void ARexxFunc_SetPalette(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1430. {
  1431. char *stem = (char *) cmd->ac_ArgList[0];
  1432. BOOL fast = (ULONG) cmd->ac_ArgList[1];
  1433. char varbuf[100] = {0};
  1434.  
  1435. ULONG pal_length, num_colors;
  1436. struct loadrgb *TempPal = NULL;
  1437. struct RGB (*TempPalColors) [1] = NULL;
  1438. struct RGB (*PaletteColors) [1] = (struct RGB (*) [1]) (((ULONG) *(&PALETTE)) + sizeof(struct loadrgb_head));
  1439. struct DrawInfo *dri = NULL;
  1440. UWORD pen;
  1441. BOOL success = FALSE;
  1442. ULONG *value = NULL, cval, rgb8 = 0L;
  1443.  
  1444. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_012; /* error return from function */
  1445. if (IsNumber(stem)) {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  1446.  
  1447. if (stem) {
  1448.     if (dri = GetScreenDrawInfo(MYILBM.win->WScreen)) {
  1449.         num_colors = 1L << dri->dri_Depth;
  1450.         pal_length = sizeof(struct loadrgb_head) + ((num_colors + 1) * sizeof(struct RGB));
  1451.         if (TempPal = (struct loadrgb *) AllocVec(pal_length, MEMF_PUBLIC|MEMF_CLEAR)) {
  1452.             TempPal->loadrgb_lrgb.lrgb_count = num_colors;
  1453.             TempPal->loadrgb_lrgb.lrgb_first = 0;
  1454.             TempPalColors = (struct RGB (*) [1]) (((ULONG) *(&TempPal)) + sizeof(struct loadrgb_head));
  1455.             GetRGB32(ViewPortAddress(MYILBM.win)->ColorMap, 0L, num_colors, (ULONG *) TempPalColors);
  1456.  
  1457.             for (pen = 0; pen < num_colors; pen++) {
  1458.                 sprintf((char *) &varbuf, "%s.%u", stem, pen);
  1459.                 if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  1460.                     if (value) {
  1461.                         rgb8 = *value;
  1462.                         cval = rgb8 & 0xFF; rgb8 >>= 8;
  1463.                         TempPalColors[pen]->RGB_Blue = cval | (cval << 8) | (cval << 16) | (cval << 24);
  1464.                         cval = rgb8 & 0xFF; rgb8 >>= 8;
  1465.                         TempPalColors[pen]->RGB_Green = cval | (cval << 8) | (cval << 16) | (cval << 24);
  1466.                         cval = rgb8 & 0xFF;
  1467.                         TempPalColors[pen]->RGB_Red = cval | (cval << 8) | (cval << 16) | (cval << 24);
  1468.  
  1469.                         success = TRUE;
  1470.                         }
  1471.                     }
  1472.                 else {success = FALSE; break;}
  1473.                 }
  1474.  
  1475.             if (success == TRUE) {
  1476.                 if (fast) LoadRGB32(ViewPortAddress(MYILBM.win), (APTR) TempPal);
  1477.                 else Fade(MYILBM.win, (ULONG *) TempPal, 25L, 1L, FROMBLACK);
  1478.                 GetRGB32(ViewPortAddress(MYILBM.win)->ColorMap, 0L, num_colors, (ULONG *) PaletteColors);
  1479.                 cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1480.                 }
  1481.             else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018;} /* invalid argument to function */
  1482.  
  1483.             FreeVec(TempPal);
  1484.             }
  1485.         else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_003;} /* no memory available    */
  1486.         FreeScreenDrawInfo(MYILBM.win->WScreen, dri);
  1487.         }
  1488.     }
  1489.  
  1490. else {
  1491.     ModifyIDCMP(MYILBM.win, NULL);
  1492.     ClearMenuStrip(MYILBM.win);
  1493.     if (ResourceBase) res = Do_PalettePrefRequest(MYILBM.win, FMSCREENNAME, 0, 0, (struct loadrgb *) PALETTE);
  1494.     else res = ModifyPalette(MYILBM.win, MYILBM.win->LeftEdge + 25, MYILBM.win->TopEdge + 35, PALETTE);
  1495.     if (!res) {
  1496.         DisplayError(MYILBM.win, TXT_ERR_PaletteRequester, 15L);
  1497.         cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_012; /* error return from function */
  1498.         }
  1499.     else {cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;}
  1500.     ResetMenuStrip(MYILBM.win, MAINMENU);
  1501.     ModifyIDCMP(MYILBM.win, IDCMP_STANDARD);
  1502.     }
  1503. }
  1504.  
  1505. /* ARexxFunc_GetPalette(): Handle ARexx-Command 'GET_PALETTE'.  Template: "STEM/A" */
  1506.  
  1507. void ARexxFunc_GetPalette(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1508. {
  1509. char *stem = (char *) cmd->ac_ArgList[0];
  1510. char varbuf[100] = {0};
  1511. char valbuf[100] = {0};
  1512. struct RGB (*PaletteColors) [1] = (struct RGB (*) [1]) (((ULONG) *(&PALETTE)) + sizeof(struct loadrgb_head));
  1513. struct DrawInfo *dri = NULL;
  1514. UWORD pen;
  1515. ULONG value = 0L, num_colors;
  1516.  
  1517. BOOL success = TRUE;
  1518.  
  1519. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_012; /* error return from function */
  1520. if (IsNumber(stem)) {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  1521.  
  1522. if (dri = GetScreenDrawInfo(MYILBM.win->WScreen)) {
  1523.     num_colors = 1L << dri->dri_Depth;
  1524.  
  1525.     for (pen = 0; pen < num_colors; pen++) {
  1526.         value = (PaletteColors[pen]->RGB_Blue & 0xFF) | 
  1527.                     (PaletteColors[pen]->RGB_Green & 0xFF00) |
  1528.                     (PaletteColors[pen]->RGB_Red & 0xFF0000);
  1529.         sprintf((char *) &varbuf, "%s.%u", stem, pen);
  1530.         if    (SetRexxVar(rm, (CONST_STRPTR) &varbuf, (CONST_STRPTR) &value, sizeof(ULONG))) {
  1531.             success = FALSE;
  1532.             break;
  1533.             }
  1534.         }
  1535.     FreeScreenDrawInfo(MYILBM.win->WScreen, dri);
  1536.     }
  1537. if (success != FALSE) {cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;}
  1538. }
  1539.  
  1540. /* ARexxFunc_SetScreenAttrs(): Handle ARexx-Command 'SET_SCREENATTRS'.   Template: "STEM,FAST/S" */
  1541. void ARexxFunc_SetScreenAttrs(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1542. {
  1543. char *stem = (char *) cmd->ac_ArgList[0];
  1544. BOOL fast = (ULONG) cmd->ac_ArgList[1];
  1545. char varbuf[100] = {0};
  1546. struct FM_RxCmd_SET_SCREENATTRS *args = NULL;
  1547. ULONG tmp_mode;
  1548. WORD tmp_width, tmp_height, tmp_depth, tmp_oscan;
  1549. ULONG *value = NULL;
  1550.  
  1551. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_012; /* error return from function */
  1552. if (IsNumber(stem)) {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  1553.  
  1554. if (stem) {
  1555.     sprintf((char *) &varbuf, "%s.MODE", stem);                            /* screen-mode */
  1556.     if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  1557.         tmp_mode = *value;
  1558.         if (!(ModeNotAvailable(tmp_mode))) {
  1559.  
  1560.             sprintf((char *) &varbuf, "%s.WIDTH", stem);                        /* screen-width */
  1561.             if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  1562.                 tmp_width = atol((const char *) value);
  1563.                 if ((errno != ERANGE) && (IsNumber((char *) value))) {
  1564.                     if (!tmp_width) tmp_width = STDSCREENWIDTH;
  1565.  
  1566.                     sprintf((char *) &varbuf, "%s.HEIGHT", stem);                /* screen-height */
  1567.                     if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  1568.                         tmp_height = atol((const char *) value);
  1569.                         if ((errno != ERANGE) && (IsNumber((char *) value))) {
  1570.                             if (!tmp_height) tmp_height = STDSCREENHEIGHT;
  1571.  
  1572.                             sprintf((char *) &varbuf, "%s.DEPTH", stem);                /* screen-depth */
  1573.                             if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  1574.                                 tmp_depth = atol((const char *) value);
  1575.                                 if ((errno != ERANGE) && (IsNumber((char *) value))) {
  1576.                                     if (!tmp_depth) tmp_depth = 8;
  1577.  
  1578.                                     sprintf((char *) &varbuf, "%s.OSCANTYPE", stem);    /* overscan-type */
  1579.                                     if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  1580.                                         char *tmpstr = (char *) value;
  1581.                                         if (!(strcmp(tmpstr, "TEXT"))) tmp_oscan = OSCAN_TEXT;
  1582.                                         else if (!(strcmp(tmpstr, "STANDARD"))) tmp_oscan = OSCAN_STANDARD;
  1583.                                             else if (!(strcmp(tmpstr, "MAX"))) tmp_oscan = OSCAN_MAX;
  1584.                                                 else if (!(strcmp(tmpstr, "VIDEO"))) tmp_oscan = OSCAN_VIDEO;
  1585.                                                     else tmp_oscan = OSCAN_TEXT;
  1586.                                         }
  1587.                                     else return;
  1588.                                     }
  1589.                                 else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  1590.                                 }
  1591.                             else return;
  1592.                             }
  1593.                         else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  1594.                         }
  1595.                     else return;
  1596.                     }
  1597.                 else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  1598.                 }
  1599.             else return;
  1600.             }
  1601.         else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  1602.         }
  1603.     else return;
  1604.     }
  1605. else {
  1606.     tmp_mode = INVALID_ID; tmp_width = STDSCREENWIDTH; tmp_height = STDSCREENHEIGHT, tmp_depth = 8;
  1607.     tmp_oscan = OSCAN_TEXT;
  1608.     }
  1609.  
  1610. #if 1                                /* external */
  1611. if (args = (struct FM_RxCmd_SET_SCREENATTRS *) AllocVec(sizeof(struct FM_RxCmd_SET_SCREENATTRS), MEMF_PUBLIC|MEMF_CLEAR)) {
  1612.     args->FMRC_SETSCR_ModeID = tmp_mode;
  1613.     args->FMRC_SETSCR_Width = tmp_width;
  1614.     args->FMRC_SETSCR_Height = tmp_height;
  1615.     args->FMRC_SETSCR_Depth = tmp_depth;
  1616.     args->FMRC_SETSCR_OScanType = tmp_oscan;
  1617.     args->FMRC_SETSCR_Fast = fast;
  1618.     if (AddARexxEvent(NEWDISPLAY_MSG, (APTR) args)) {
  1619.         cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1620.         }
  1621.     else FreeVec(args);
  1622.     }
  1623. #else                                /* internal */
  1624. ;
  1625. #endif
  1626. }
  1627.  
  1628. /* ARexxFunc_GetScreenAttrs(): Handle ARexx-Command 'GET_SCREENATTRS'.   Template: "STEM/A" */
  1629. void ARexxFunc_GetScreenAttrs(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1630. {
  1631. char *stem = (char *) cmd->ac_ArgList[0];
  1632. char varbuf[100] = {0};
  1633. char valbuf[100] = {0};
  1634. struct Screen *scr = NULL;
  1635. struct DrawInfo *di = NULL;
  1636.  
  1637. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_012; /* error return from function */
  1638. if (IsNumber(stem)) {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  1639.  
  1640. if (scr = LockPubScreen(FMSCREENNAME)) {
  1641.     if (di = GetScreenDrawInfo(scr)) {
  1642.         ULONG modeid = GetVPModeID((CONST struct ViewPort *) &scr->ViewPort);
  1643.  
  1644.         sprintf((char *) &varbuf, "%s.MODE", stem); //sprintf((char *) &valbuf, "'%X'x", modeid);
  1645.         if    (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &modeid, sizeof(ULONG)))) {
  1646.  
  1647.             sprintf((char *) &varbuf, "%s.WIDTH", stem); sprintf((char *) &valbuf, "%d", scr->Width);
  1648.             if    (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  1649.  
  1650.                 sprintf((char *) &varbuf, "%s.HEIGHT", stem); sprintf((char *) &valbuf, "%d", scr->Height);
  1651.                 if (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  1652.  
  1653.                     sprintf((char *) &varbuf, "%s.DEPTH", stem); sprintf((char *) &valbuf, "%d", di->dri_Depth);
  1654.                     if (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  1655.  
  1656.                         cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1657.                         }
  1658.                     }
  1659.                 }
  1660.             }
  1661.         FreeScreenDrawInfo(scr, di);
  1662.         }
  1663.     UnlockPubScreen(FMSCREENNAME, scr);
  1664.     }
  1665. }
  1666.  
  1667. /* ARexxFunc_SetFont(): Handle ARexx-Command 'SET_FONT'.  Template: "STEM,FAST/S" */
  1668.  
  1669. void ARexxFunc_SetFont(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1670. {
  1671. char *stem = (char *) cmd->ac_ArgList[0];
  1672. BOOL fast = (ULONG) (cmd->ac_ArgList[1]);
  1673. char varbuf[100] = {0};
  1674. struct FM_RxCmd_SET_FONT *args = NULL;
  1675. STRPTR tmp_fontname = DEF_FONTNAMESTR;
  1676. UWORD tmp_size = DEF_FONTSIZE, size1 = 0, temp;
  1677. UWORD tmp_style = MYFONTSTRUCT.ta_Style & ~(FSF_UNDERLINED | FSF_BOLD | FSF_ITALIC | FSF_EXTENDED);
  1678. STRPTR tmp_style_str = NULL;
  1679. ULONG *value = NULL;
  1680.  
  1681. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_012; /* error return from function */
  1682. if (IsNumber(stem)) {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  1683.  
  1684. if (stem) {
  1685.     sprintf((char *) &varbuf, "%s.FONTNAME", stem);                        /* font-name */
  1686.     if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  1687.         if (value) tmp_fontname = (STRPTR) value;
  1688.  
  1689.         sprintf((char *) &varbuf, "%s.SIZE", stem);                            /* font-size */
  1690.         if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  1691.             temp = atol((const char *) value);
  1692.             if ((errno |= ERANGE) && (IsNumber((char *) value))) {
  1693.                 if (temp) tmp_size = temp;
  1694.  
  1695.                 sprintf((char *) &varbuf, "%s.STYLE", stem);                        /* font-style */
  1696.                 if (!(GetRexxVar(rm, (STRPTR) &varbuf, (STRPTR *) &value))) {
  1697.                     tmp_style_str = (STRPTR) value;
  1698.                     if (!(tmp_style_str)) tmp_style_str = "NORMAL";
  1699.  
  1700.                     if (strcmp(tmp_style_str, "NORMAL")) {
  1701.                         char *result = NULL;
  1702.                         char *templ = tmp_style_str;
  1703.  
  1704.                         while (1L) {
  1705.                             if (!(result = strtok(templ, ","))) break;
  1706.                             if (!(strcmp(result, "ITALIC"))) tmp_style |= FSF_ITALIC;
  1707.                                 else if (!(strcmp(result, "BOLD"))) tmp_style |= FSF_BOLD;
  1708.                                     else if (!(strcmp(result, "UNDERLINED"))) tmp_style |= FSF_UNDERLINED;
  1709.                                         else if (!(strcmp(result, "EXTENDED"))) tmp_style |= FSF_EXTENDED;
  1710.                             templ = NULL;
  1711.                             }
  1712.  
  1713.                         }
  1714.                     }
  1715.                 else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  1716.                 }
  1717.             else return;
  1718.             }
  1719.         else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  1720.         }
  1721.     else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  1722.     }
  1723. else tmp_fontname = NULL;
  1724.  
  1725. #if 1                                /* external */
  1726. if (tmp_fontname) size1 = strlen((const char *) tmp_fontname) + 1;
  1727. if (args = (struct FM_RxCmd_SET_FONT *) AllocVec(sizeof(struct FM_RxCmd_SET_FONT) + size1, MEMF_PUBLIC|MEMF_CLEAR)) {
  1728.     if (size1) {
  1729.         char *Str = (char *) ((ULONG) args + sizeof(struct FM_RxCmd_SET_FONT));
  1730.         strcpy(Str, (const char *) tmp_fontname);
  1731.         args->FMRC_SETFNT_FontName = (STRPTR) Str;
  1732.         }
  1733.     else args->FMRC_SETFNT_FontName = NULL;
  1734.     args->FMRC_SETFNT_Size = tmp_size;
  1735.     args->FMRC_SETFNT_Style = tmp_style;
  1736.     if (AddARexxEvent(FONTREQ_MSG, (APTR) args)) {
  1737.         cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1738.         }
  1739.     else FreeVec(args);
  1740.     }
  1741. #else                                /* internal */
  1742. ;
  1743. #endif
  1744. }
  1745.  
  1746. /* ARexxFunc_GetFont(): Handle ARexx-Command 'GET_FONT'.  Template: "STEM/A" */
  1747.  
  1748. void ARexxFunc_GetFont(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1749. {
  1750. char *stem = (char *) cmd->ac_ArgList[0];
  1751. char varbuf[100] = {0};
  1752. char valbuf[100] = {0};
  1753. ULONG offset = 0;
  1754.  
  1755. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_012; /* error return from function */
  1756. if (IsNumber(stem)) {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018; return;} /* invalid argument to function */
  1757.  
  1758. sprintf((char *) &varbuf, "%s.FONTNAME", stem); sprintf((char *) &valbuf, "%s", MYFONTSTRUCT.ta_Name);
  1759. if    (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  1760.  
  1761.     sprintf((char *) &varbuf, "%s.SIZE", stem); sprintf((char *) &valbuf, "%d", MYFONTSTRUCT.ta_YSize);
  1762.     if    (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  1763.  
  1764.         UWORD style = MYFONTSTRUCT.ta_Style;
  1765.         if (style & FSF_ITALIC) offset += sprintf((char *) ((ULONG) &valbuf + offset), "ITALIC,");
  1766.         if (style & FSF_BOLD) offset += sprintf((char *) ((ULONG) &valbuf + offset), "BOLD,");
  1767.         if (style & FSF_UNDERLINED) offset += sprintf((char *) ((ULONG) &valbuf + offset), "UNDERLINED,");
  1768.         if (style & FSF_EXTENDED) offset += sprintf((char *) ((ULONG) &valbuf + offset), "EXTENDED,");
  1769.         if (offset) valbuf[--offset] = 0;
  1770.         else strcpy((char *) &valbuf, "NORMAL");
  1771.         sprintf((char *) &varbuf, "%s.STYLE", stem);
  1772.  
  1773.         if (!(SetRexxVar(rm, (STRPTR) &varbuf, (STRPTR) &valbuf, (LONG) strlen((const char *) &valbuf)))) {
  1774.             cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1775.             }
  1776.         }
  1777.     }
  1778. }
  1779.  
  1780. /* ARexxFunc_StartTimer(): Handle ARexx-Command 'START_TIMER'.  Template: -  */
  1781.  
  1782. struct timeval timer1;            /* global vars */
  1783. BOOL timer_started = FALSE;
  1784.  
  1785. void ARexxFunc_StartTimer(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1786. {
  1787. GetSysTime(&timer1);
  1788. timer_started = TRUE;
  1789. }
  1790.  
  1791. /* ARexxFunc_StopTimer(): Handle ARexx-Command 'STOP_TIMER'.  Template: -  */
  1792.  
  1793. void ARexxFunc_StopTimer(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1794. {
  1795. struct timeval timer2 = {0};
  1796.  
  1797. cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1798.  
  1799. if (timer_started == TRUE) {
  1800.     GetSysTime(&timer2);
  1801.     SubTime(&timer2, &timer1);
  1802.     timer_started = FALSE;
  1803.  
  1804.     if (rm->rm_Action & RXFF_RESULT) {
  1805.         char string[100];
  1806.         STRPTR ResultString;
  1807.  
  1808.         sprintf((STRPTR) &string, "%lu.%07lu", timer2.tv_secs, timer2.tv_micro);
  1809.         if (ResultString = CreateArgstring((STRPTR) &string, strlen((const char *) &string))) {
  1810.             cmd->ac_Result = ResultString;
  1811.             }
  1812.         }
  1813.     }
  1814.  
  1815. else {
  1816.     cmd->ac_RC = RC_WARN; cmd->ac_RC2 = 0; /* timer not started */
  1817.     DisplayBeep(MYILBM.scr);
  1818.     }
  1819. }
  1820.  
  1821. /* ARexxFunc_PlaySound(): Handle ARexx-Command 'PLAY_SOUND'.  Template: "PATH/A,ASYNC/S,REPEAT/S" */
  1822.  
  1823. Object *SoundObject = NULL;
  1824.  
  1825. void ARexxFunc_PlaySound(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1826. {
  1827. char *filename = (char *) cmd->ac_ArgList[0];
  1828. BOOL async = (ULONG) (cmd->ac_ArgList[1]);
  1829. BOOL repeat = (ULONG) (cmd->ac_ArgList[2]);
  1830.  
  1831. cmd->ac_RC = RC_FATAL; cmd->ac_RC2 = ERR10_012; /* error return from function */
  1832.  
  1833. if (async == FALSE) repeat = FALSE; /* repeat only in async-mode */
  1834. if ((async == FALSE) && (DataTypesBase->lib_Version < 40)) return; /* Need V40 for sync, because of SDTA_SignalTask ... */
  1835. if (SoundObject) DisposeDTObject(SoundObject); /* if async */
  1836.  
  1837. PutPointer(MYILBM.win, 0, 0, 0, 0, 0, BUSY_POINTER);
  1838. if (SoundObject = NewDTObject(filename, DTA_SourceType, DTST_FILE,
  1839.                                                      DTA_GroupID, GID_SOUND, DTA_Repeat, repeat,
  1840.                                                      TAG_DONE)) {
  1841.     if (async == FALSE) {
  1842.         ULONG readysig = 0L, readymask = 0L;
  1843.         struct Task *owntask;
  1844.         if ((readysig = AllocSignal(-1)) != -1) {
  1845.             readymask = 1 << readysig;
  1846.             owntask = FindTask(NULL);
  1847.             SetDTAttrs(SoundObject, MYILBM.win, NULL,
  1848.                           SDTA_SignalTask, owntask,
  1849.                           SDTA_SignalBitMask, readymask, TAG_DONE);
  1850.             DoDTMethod(SoundObject, NULL, NULL, DTM_TRIGGER, NULL, STM_PLAY, NULL);
  1851.             Wait(readymask|SIGBREAKF_CTRL_C);
  1852.             DisposeDTObject(SoundObject); SoundObject = NULL;
  1853.             FreeSignal(readysig);
  1854.             cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1855.             }
  1856.         }
  1857.     else {
  1858.         DoDTMethod(SoundObject, NULL, NULL, DTM_TRIGGER, NULL, STM_PLAY, NULL);
  1859.         cmd->ac_RC = RC_OK; cmd->ac_RC2 = 0;
  1860.         }
  1861.     }
  1862.  
  1863. else {cmd->ac_RC = RC_ERROR; cmd->ac_RC2 = ERR10_018;} /* invalid argument to function */
  1864. PutPointer(MYILBM.win, ZoomPointer, ZPW, ZPH, ZPXO, ZPYO, ZOOM_POINTER);
  1865. }
  1866.  
  1867. /* ARexxFunc_StopSound(): Handle ARexx-Command 'STOP_SOUND'.  Template: - */
  1868.  
  1869. void ARexxFunc_StopSound(REG(a0, struct ARexxCmd *cmd), REG(a1, struct RexxMsg *rm))
  1870. {
  1871. if (SoundObject) {DisposeDTObject(SoundObject); SoundObject = NULL;}
  1872. }
  1873.  
  1874. /* HandleARexxEvents(): Handle external arexx-events.
  1875.  
  1876.         SYNOPSIS: ULONG retcode = HandleARexxEvents
  1877.                         (
  1878.                         struct ILBMInfo  *Ilbm;
  1879.                         LONG                  *Error;
  1880.                         );
  1881.  
  1882.         INPUTS:        Ilbm:
  1883.                             Pointer to the ILBMInfo-structure.
  1884.  
  1885.                         Error:
  1886.                             Pointer to a ULONG-var, to return a error.code.
  1887.  
  1888.         RETURNS:        retcode:
  1889.                             Messagecode or 0;
  1890. */
  1891.  
  1892. ULONG HandleARexxEvents(struct ILBMInfo *Ilbm, LONG *Error)
  1893. {
  1894. ULONG retcode = 0;
  1895. struct FM_ARexxEvent *act_event = NULL;
  1896.  
  1897. while (IsListEmpty(&ARexxEventList) == FALSE) {
  1898.     act_event = (struct FM_ARexxEvent *) ARexxEventList.lh_Head;
  1899.  
  1900.     switch (act_event->FMRXC_Command) {
  1901.  
  1902.         case EXIT_MSG: {                            /* EXIT_MSG - "QUIT" */
  1903.             struct FM_RxCmd_QUIT *args = (struct FM_RxCmd_QUIT *) act_event->FMRXC_Args;
  1904.             retcode = EXIT_MSG;
  1905.             ForceAbort = args->FMRC_QUIT_Force;
  1906.             break;
  1907.             }
  1908.  
  1909.         case LOADPICTURE_MSG: {                    /* LOADPICTURE_MSG - "LOAD_PICTURE" */
  1910.             struct FM_RxCmd_LOADPIC *msg_loadpic = (struct FM_RxCmd_LOADPIC *) act_event->FMRXC_Args;
  1911.  
  1912.             if (!(msg_loadpic->FMRC_LOADPIC_Path)) {
  1913.                 if (!(FileRequest(Ilbm->win, CATSTR(TXT_LoadPictureTitle), "FLASHMANDEL:Pictures", PICTURES_DRAWER, FALSE))) {
  1914.                     goto LOAD_PIC_END;
  1915.                     }
  1916.                 }
  1917.             else strncpy(MYPATH, msg_loadpic->FMRC_LOADPIC_Path, MAX_PATHLEN);
  1918.             PutPointer(Ilbm->win, 0, 0, 0, 0, 0, BUSY_POINTER);
  1919.             if (Ilbm->ParseInfo.iff = AllocIFF()) {
  1920.                 SaveCoords (Ilbm->win, TRUE);
  1921.                 if (! (*Error = QueryMandPic(Ilbm, &MANDChunk, MYPATH))) {
  1922.                     RMIN = MANDChunk.RMin;
  1923.                     RMAX = MANDChunk.RMax;
  1924.                     IMIN = MANDChunk.IMin;
  1925.                     IMAX = MANDChunk.IMax;
  1926.                     JKRE  = MANDChunk.JKre;
  1927.                     JKIM  = MANDChunk.JKim;
  1928.                     MAX_ITERATIONS = MANDChunk.Iterations - 1L;
  1929.                     if (msg_loadpic->FMRC_LOADPIC_Fast == FALSE) {
  1930.                         Fade(MYILBM.win, PALETTE, 25L, 1L, TOBLACK);
  1931.                         }
  1932.                     CloseDisplay(Ilbm, VINFO);
  1933.                     Ilbm->IFFPFlags = IFFPF_BESTFIT;
  1934.                     COLORS = MakeDisplay(Ilbm);
  1935.                     Ilbm->IFFPFlags = NULL;
  1936.                     if (! COLORS) {
  1937.                         DisplayError(Ilbm->win, TXT_ERR_MakeDisplay, 20L);
  1938.                         retcode = EXIT_MSG;
  1939.                         break;
  1940.                         }
  1941.                     MASK &= ~ZMASK;
  1942.                     COLORS -= RESERVED_PENS;
  1943.                     if (TMASK & MASK) ShowTitle(Ilbm->scr, FALSE);
  1944.                     if (LoadMandPic(Ilbm, MYPATH, ~msg_loadpic->FMRC_LOADPIC_Fast)) DisplayError(Ilbm->win, TXT_ERR_LoadMandPic, 5L);
  1945.                     if (TMASK & MASK) ShowTitle(Ilbm->scr, TRUE);
  1946.                     GetRGB32(Ilbm->vp->ColorMap, 0L, (ULONG) Ilbm->vp->ColorMap->Count, PALETTE + 1L);
  1947.                     CheckMenu(Ilbm->win);
  1948.                     }
  1949.                 else DisplayError(Ilbm->win, TXT_ERR_QueryMandPic, 0);
  1950.                 FreeIFF(Ilbm->ParseInfo.iff);
  1951.                 }
  1952.             LOAD_PIC_END:
  1953.             PutPointer(Ilbm->win, ZoomPointer, ZPW, ZPH, ZPXO, ZPYO, ZOOM_POINTER);
  1954.             break;
  1955.             }
  1956.  
  1957.         case NEWDISPLAY_MSG:    {                    /* NEWDISPLAY_MSG - "SET_SCREENATTRS" */
  1958.             struct FM_RxCmd_SET_SCREENATTRS *msg_setscr = (struct FM_RxCmd_SET_SCREENATTRS *) act_event->FMRXC_Args;
  1959.             if (msg_setscr->FMRC_SETSCR_ModeID == INVALID_ID) {
  1960.                 retcode = NEWDISPLAY_MSG;
  1961.                 break;
  1962.                 }
  1963.             else {
  1964.                 Ilbm->camg = msg_setscr->FMRC_SETSCR_ModeID;
  1965.                 Ilbm->Bmhd.w = msg_setscr->FMRC_SETSCR_Width;
  1966.                 Ilbm->Bmhd.h = msg_setscr->FMRC_SETSCR_Height;
  1967.                 Ilbm->Bmhd.nPlanes = msg_setscr->FMRC_SETSCR_Depth;
  1968.                 Ilbm->ucliptype = msg_setscr->FMRC_SETSCR_OScanType;
  1969.  
  1970.                 if (ZMASK & MASK) {
  1971.                     DrawBorder(Ilbm->wrp, &MYBORDER, 0, 0);
  1972.                     MASK &= ~ZMASK;
  1973.                     }
  1974.                 if (Ilbm->win->RPort->BitMap->Depth <= Ilbm->Bmhd.nPlanes) {
  1975.                     MYBITMAP = CopyBitMap(Ilbm->win, Ilbm->win->LeftEdge, Ilbm->win->TopEdge, Ilbm->win->Width, Ilbm->win->Height);
  1976.                     }
  1977.                 Fade(Ilbm->win, PALETTE, 25L, 1L, TOBLACK);
  1978.                 CloseDisplay(&MYILBM, VINFO);
  1979.                 Ilbm->Bmhd.pageWidth = 0;
  1980.                 Ilbm->Bmhd.pageHeight = 0;
  1981.                 COLORS = MakeDisplay(Ilbm);
  1982.                 if (COLORS) {
  1983.                     COLORS -= RESERVED_PENS;
  1984.                     PasteBitMap(MYBITMAP,Ilbm->win, (WORD) GetBitMapAttr(MYBITMAP, BMA_WIDTH), (WORD) GetBitMapAttr(MYBITMAP, BMA_HEIGHT));
  1985.                     if (ResourceBase) res = Do_RenderRequest(Ilbm->win, FMSCREENNAME, 0, 0);
  1986.                     else res = Choice(Ilbm->win, CATSTR(TITLE_RenderReq), CATSTR(NewScr_TXT_Question));
  1987.                     if (res) {
  1988.                         SetMenuStop(Ilbm->win);
  1989.                         PutPointer(Ilbm->win, 0, 0, 0, 0, 0, BUSY_POINTER);
  1990.                         ELAPSEDTIME = DrawFractal(Ilbm->win, Ilbm->win->LeftEdge, Ilbm->win->TopEdge, Ilbm->win->Width, Ilbm->win->Height, TRUE);
  1991.                         PutPointer(Ilbm->win, ZoomPointer, ZPW, ZPH, ZPXO, ZPYO, ZOOM_POINTER);
  1992.                         SetMenuStart(Ilbm->win);
  1993.                         ShowTime (Ilbm->win, CATSTR(TXT_RenderTime),ELAPSEDTIME);
  1994.                         }
  1995.                     }
  1996.                 else DisplayError(NULL, TXT_ERR_MakeDisplay, 20L);
  1997.                 }
  1998.             break;
  1999.             }
  2000.  
  2001.         case FONTREQ_MSG:    {                        /* FONTREQ_MSG - "SET_FONT" */
  2002.             struct FM_RxCmd_SET_FONT *msg_setfnt = (struct FM_RxCmd_SET_FONT *) act_event->FMRXC_Args;
  2003.             if (msg_setfnt->FMRC_SETFNT_FontName) {
  2004.                 MYFONTSTRUCT.ta_Name = MYFONT;
  2005.                 strncpy(MYFONTSTRUCT.ta_Name, msg_setfnt->FMRC_SETFNT_FontName, MAX_FILELEN);
  2006.                 MYFONTSTRUCT.ta_YSize = msg_setfnt->FMRC_SETFNT_Size;
  2007.                 MYFONTSTRUCT.ta_Style = msg_setfnt->FMRC_SETFNT_Style;
  2008.                 MYFONTSTRUCT.ta_Flags = FPF_DISKFONT;
  2009.                 }
  2010.             else {
  2011.                 if (!(FontRequest(Ilbm->win))) break;
  2012.                 }
  2013.             if (ZMASK & MASK) {
  2014.                 DrawBorder(Ilbm->wrp, &MYBORDER, 0, 0);
  2015.                 MASK &= ~ZMASK;
  2016.                 }
  2017.             PutPointer(Ilbm->win, 0, 0, 0, 0, 0, BUSY_POINTER);
  2018.             MYBITMAP = CopyBitMap(Ilbm->win, Ilbm->win->LeftEdge, Ilbm->win->TopEdge, Ilbm->win->Width, Ilbm->win->Height);
  2019.             if (msg_setfnt->FMRC_SETFNT_Fast == FALSE) Fade(Ilbm->win, PALETTE, 25L, 1L, TOBLACK);
  2020.             CloseDisplay(Ilbm, VINFO);
  2021.             if (! MakeDisplay(Ilbm)) {
  2022.                 DisplayError(Ilbm->win, TXT_ERR_MakeDisplay, 20L);
  2023.                 retcode = EXIT_MSG;
  2024.                 break;
  2025.                 }
  2026.             PasteBitMap(MYBITMAP, Ilbm->win, Ilbm->win->Width, Ilbm->win->Height);
  2027.             PutPointer(Ilbm->win, ZoomPointer, ZPW, ZPH, ZPXO, ZPYO, ZOOM_POINTER);
  2028.             break;
  2029.             }
  2030.         }
  2031.     RemoveARexxEvent(act_event);
  2032.     }
  2033.  
  2034. return(retcode);
  2035. }
  2036.  
  2037. #else /* FM_AREXX_SUPPORT */
  2038. extern struct Library *ResourceBase;  /* dummy */
  2039. #endif /* FM_AREXX_SUPPORT */
  2040.